Inhaltsverzeichnis

Tipps zur (objektorientierten) Programmierung

Allgemein

Single Responsibility Principle

Werkzeuge

Namensgebung

nach \cite[S. 43ff.]{Goodliffe2006}

Defensive Programmierung

nach \cite[S. 6ff.]{Goodliffe2006}

In \cite[45:00]{RubyRogues47} sprechen sich die Teilnehmer dafür aus, nicht in allen internen Komponenten erneut Datengültigkeitsprüfungen durchzuführen (also auf defensive Programmierung zu verzichten), sondern lediglich in einer "Guard"-Klasse, deren einzige Aufgabe (→ Single Responsibility Principle) es ist, Eingaben zu validieren. Alles, was in das System reinkommt, muss diese zentrale Prüfung bestehen, sodass im Inneren des Systems von gültigen Daten ausgegangen werden kann.

Codeoptimierungen

(siehe Skript Datenstrukturen und Algorithmen)

nach \cite[S. 214ff.]{Goodliffe2006}

nach \cite[S. 200ff.]{Goodliffe2006}

Checklisten

nach \cite{Atwood2006}

  1. Do you use source control?
  2. Can you make a build in one step?
  3. Do you make daily builds?
  4. Do you have a bug database?
  5. Do you fix bugs before writing new code?
  6. Do you have an up-to-date schedule?
  7. Do you have a spec?
  8. Do programmers have quiet working conditions?
  9. Do you use the best tools money can buy?
  10. Do you have testers?
  11. Do new candidates write code during their interview?
  12. Do you do hallway usability testing?

Code is considered to be "done", when:

nach \cite{Roden2010b}

  1. It does satisfy all its functional and non-functional requirements.
  2. It does not contain any known errors.
  3. It has been commented and documented.
  4. It has been either pair-programmed or reviewed.
  5. It has been developed test-driven using 4-Step TDD.
  6. It does not need to be refactored or rearranged.
  7. It has been written according to well-known best practices.
  8. It does conform to accepted coding standards.
  9. It does pass static code analysis without any errors or warnings.
  10. It has been integrated and does not break the integration build.
  11. It has been checked in into source control.

When to throw an exception

nach \cite[S. 69]{Seguin2008}

Generally speaking, I find it easy to decide what should and shouldn't throw an exception. I generally ask myself questions like:

Continuous Improvement (als Entwickler)

Fragen, die man sich als (guter) Entwickler öfter einmal stellen sollte (nach \cite[]{KanatAlexander2009}):

Punkte, die man für den erfolgreichen Betrieb der Software berücksichtigen sollte

nach \cite{Nygard2009}