summaryrefslogtreecommitdiffstats
path: root/Bachelor/Prog1/Codierungsstandard.htm
blob: 844c06d344b24f6902e03f15779b737fa9de4bbb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
<html><head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

<title>Codierungs-Standard</title><style>
<!--
 p.MsoNormal
	{mso-style-parent:"";
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman";
	margin-left:0cm; margin-right:0cm; margin-top:0cm}
 li.MsoNormal
	{mso-style-parent:"";
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman";
	margin-left:0cm; margin-right:0cm; margin-top:0cm}
-->
</style></head>

<body>

<p class="MsoNormal" style="">
<span style="font-size: 14.5pt; font-family: Arial;">Codierungs-Standard</span></p>
<p class="MsoNormal" style="">
<span style="font-size: 14.5pt; font-family: Arial;"></span></p>
<p class="MsoNormal" style="">
<span style="font-size: 10pt; font-family: Arial;">Der hier angef�hrte 
Codierungs-Standard ist im wesentlichen aus dem Buch von Schmaranz (s. 
Literaturliste) �bernommen. Er ist in einigen wenigen Punkten modifiziert, so 
dass er mit den in der Vorlesung verwendeten Beispielen konform ist. Es sind 
nat�rlich auch andere Standards denkbar und sinnvoll, f�r die Praktikumsaufgaben
<b>und in der Klausur </b>ist jedoch dieser Standard einzuhalten!</span></p>
<p class="MsoNormal" style="">
<span style="font-size: 10pt; font-family: Arial;"></span></p>
<p class="MsoNormal" style=""><b>
<span style="font-family: Arial;">1 ��Generelle Regeln</span></b></p>
<p class="MsoNormal" style="">
<span style="font-family: Arial;"></span></p>
<p class="MsoNormal" style="">
<span style="font-size: 10pt; font-family: Arial;">Die folgenden Prinzipien sind 
essentiell f�r die Lesbarkeit, Wartbarkeit und Erweiterbarkeit eines Programms:</span></p>
<p class="MsoNormal" style="">
<span style="font-size: 10pt; font-family: Arial;"></span></p>
<p class="MsoNormal" style=""><b>
<span style="font-size: 10pt; font-family: Arial;">Einfachheit:</span></b><span style="font-size: 10pt; font-family: Arial;"> 
Das Prinzip der Einfachheit ist auch als das KISS-Prinzip (<b>K</b>eep <b>I</b>t
<b>S</b>mall and <b>S</b>imple) bekannt. Kurz gesagt sollen Methoden, Funktionen 
und nat�rlich auch Operatoren genau eine, f�r ihren Abstraktionslevel ad�quate, 
atomare Aufgabe erf�llen. Niemals sollen mehrere Aufgaben auf einmal erledigt 
werden, genauso wenig, wie Aufgaben erledigt werden sollen, die in ein anderes 
Abstraktionslevel geh�ren (=Durchgriff nach unten oder oben). Parameterlisten 
sollen so kurz und �bersichtlich wie m�glich gehalten werden. Methoden, 
Operatoren und Funktionen sollen als Faustregel nicht mehr als 60 Zeilen lang 
sein. Eine durchschnittliche L�nge von ca. 30 Zeilen ist zu bevorzugen. 
Seiteneffekte sind absolut zu vermeiden!</span></p>
<p class="MsoNormal" style="">
<span style="font-size: 10pt; font-family: Arial;"></span></p>
<p class="MsoNormal" style=""><b>
<span style="font-size: 10pt; font-family: Arial;">Intuitivit�t: </span></b>
<span style="font-size: 10pt; font-family: Arial;">Das Prinzip der Intuitivit�t 
bedeutet, dass man den geschriebenen Source-Code "wie ein Buch" lesen und 
verstehen k�nnen muss, und zwar ohne Kommentare im Source-Code und ohne 
Erkl�rungen des Programmierers! Damit ist impliziert, dass Variablen-, Methoden- 
und Funktionsnamen sprechend (=selbsterkl�rend) und genau ihrer Funktionalit�t 
entsprechend benannt sein m�ssen. Einbuchstabenvariablen, wie z.B. i, sind nur 
in Sonderf�llen wie Schleifenz�hler erlaubt. Unn�tige Kommentare werden als 
st�rend erachtet und sollen dementsprechend weggelassen werden. Ein typisches 
Beispiel f�r solche unn�tigen Kommentare w�re:</span></p>
<p class="MsoNormal" style="">
<span style="font-size: 10pt; font-family: Courier New;" lang="EN-GB">count++; 
// and here the counter is incremented</span></p>
<p class="MsoNormal" style="">
<span style="font-size: 10pt; font-family: Arial;"></span></p>
<p class="MsoNormal" style=""><b>
<span style="font-size: 10pt; font-family: Arial;">Einheitlichkeit:</span></b><span style="font-size: 10pt; font-family: Arial;"> Verwandte Teile im Source-Code m�ssen denselben Prinzipien folgen. Wenn 
z.B. eine Funktion </span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">copy</span><span style="font-size: 10pt; font-family: Arial;"> 
als ersten Parameter den Zielort und als zweiten Parameter den Ursprungsort 
nimmt, dann m�ssen verwandte Funktionen, wie z.B. </span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">move</span><span style="font-size: 10pt; font-family: Arial;">, 
sich an dieselben Konventionen halten. Genauso gilt dies auch f�r Klassen und 
ihre Methoden. Nehmen wir z.B. eine Klasse die einen Knoten f�r z.B. eine 
einfach verkettete Liste repr�sentiert. Wenn in dieser Klasse der nachfolgende 
Knoten �ber Aufruf von </span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">next()</span><span style="font-size: 10pt; font-family: Arial;"> 
erreichbar ist, dann darf er nicht in einem Knoten f�r eine doppelt verkettete 
Liste auf einmal �ber Aufruf von </span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">successor()</span><span style="font-size: 10pt; font-family: Arial;"> 
erreichbar sein.</span></p>
<p class="MsoNormal" style="">
<span style="font-size: 10pt; font-family: Arial;"></span></p>
<p class="MsoNormal" style="">
<span style="font-size: 10pt; font-family: Arial;"></span></p>
<p class="MsoNormal" style=""><b>
<span style="font-family: Arial;">2 ��Codierungs-Regeln</span></b></p>
<p class="MsoNormal" style="">
<span style="font-size: 10pt; font-family: Arial;"></span></p>
<p class="MsoNormal" style="">
<span style="font-size: 10pt; font-family: Arial;">Die hier angef�hrten Regeln 
helfen, den Source-Code so weit wie m�glich zu vereinheitlichen und damit die 
Arbeit in einem Team zu erleichtern:</span></p>
<ul style="margin-top: 0cm; margin-bottom: 0cm;" type="disc">
  <li class="MsoNormal" style=""><b>
  <span style="font-size: 10pt; font-family: Arial;">Die Sprache f�r Source-Code 
  ist Englisch. Dies gilt f�r alle Teile eines Programms</span></b><span style="font-size: 10pt; font-family: Arial;">, 
  von Variablennamen �ber Methoden- und Funktionsnamen bis hin zu Kommentaren im 
  Source-Code.</span></li>
  <li class="MsoNormal" style="">
  <span style="font-size: 10pt; font-family: Arial;">Der Gebrauch von Block-Kommentaren </span>
  <span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">(/* comment 
  */</span><span style="font-size: 10pt; font-family: Arial;">) ist zu vermeiden. 
  Stattdessen m�ssen Zeilenkommentare (</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">// comment</span><span style="font-size: 10pt; font-family: Arial;">) eingesetzt werden. Dies macht Source-Code robuster gegen 
  �nderungen und erleichtert das Debugging</span></li>
  <li class="MsoNormal" style="">
  <span style="font-size: 10pt; font-family: Arial;">Wenn es sich nicht vermeiden l�sst, z.B. 
  algorithmische Details in Form von Kommentaren in den Source-Code 
  einzubringen, dann ist ein Block mit einer vollst�ndigen Erkl�rung des 
  Algorithmus vor der Implementation des Algorithmus selbst zu schreiben. Es 
  darf die Kommentierung des Algorithmus nicht im laufenden Source-Code Zeile 
  f�r Zeile erfolgen, denn sonst wird der Code durch die Kommentare unleserlich. 
  Nat�rlich sind wenige, kurze Kommentare in Form von Cross-References zur 
  vollst�ndigen Erkl�rung manchmal sinnvoll und deshalb erlaubt.</span></li>
  <li class="MsoNormal" style="">
  <span style="font-size: 10pt; font-family: Arial;">Sollten jemals Codezeilen in das Programm Eingang 
  finden, bei denen beim Lesen der Zeile nicht sofort klar ist, was sie tut, 
  dann muss dies in einem kurzen Kommentar dort festgehalten werden. Jedoch 
  sollte man sich immer sehr gut �berlegen, ob es nicht eigentlich ein besseres, 
  leichter lesbares Konstrukt gibt, das keinen Kommentar ben�tigt, um verstanden 
  zu werden.</span></li>
  <li class="MsoNormal" style="">
  <span style="font-size: 10pt; font-family: Arial;">Globale Variablen sind nach allen M�glichkeiten 
  zu vermeiden!</span></li>
  <li class="MsoNormal" style="">
  <span style="font-size: 10pt; font-family: Arial;">C-Style Casts sind zu vermeiden. Stattdessen 
  m�ssen die "echten" C++-Casts </span>
  <span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">static_cast</span><span style="font-size: 10pt; font-family: Arial;">, </span>
  <span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">dynamic_cast</span><span style="font-size: 10pt; font-family: Arial;">, etc. Anwendung finden.</span></li>
  <li class="MsoNormal" style="">
  <span style="font-size: 10pt; font-family: Arial;">Wenn aus irgendwelchen Gr�nden b�se Hacks im 
  Source-Code tempor�r nicht vermeidbar sind (z.B. Zeitdruck), so sind diese 
  unbedingt in hackstart und hack-end Kommentare zu fassen, damit man sie 
  einfach wieder finden und ausbessern kann. Die hack-... Kommentare haben die 
  folgendeForm:<br>
  </span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">// 
  FIXXME (&lt;author, date&gt;) -&gt; &lt;description of the hack&gt;<br>
  [..... the code with the hack .....]<br>
  // END FIXXME (&lt;author, date&gt;)</span><span style="font-size: 10pt; font-family: Arial;"><br>
  Hier geh�rt das Keyword </span>
  <span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">FIXXME</span><span style="font-size: 10pt; font-family: Arial;"> immer mit zumindest zwei '</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">X</span><span style="font-size: 10pt; font-family: Arial;">' geschrieben, denn damit kann man leicht nach ihm 
  suchen. Je nachdem, wie schlimm der Hack ist, k�nnen auch mehrere '</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">X</span><span style="font-size: 10pt; font-family: Arial;">' 
  vorkommen. Als Faustregel f�r die Abstufung gilt, dass der SVH (=Schlimmste 
  Vorstellbare Hack) mit 5 '</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">X</span><span style="font-size: 10pt; font-family: Arial;">' 
  geschrieben wird.</span></li>
  <li class="MsoNormal" style="">
  <span style="font-size: 10pt; font-family: Arial;">Klassendeklarationen m�ssen von ihren 
  Definitionen getrennt und in einem separaten Header File gespeichert werden.</span></li>
  <li class="MsoNormal" style="">
  <span style="font-size: 10pt; font-family: Arial;">Alle Klassen m�ssen einen </span>
  <span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">virtual</span><span style="font-size: 10pt; font-family: Arial;"> 
  Destruktor besitzen.</span></li>
  <li class="MsoNormal" style="">
  <span style="font-size: 10pt; font-family: Arial;">Alle Klassen m�ssen sowohl den Copy-Constructor 
  als auch den Zuweisungsoperator explizit implementieren. Wenn keine 
  Implementation der beiden gew�nscht ist, dann m�ssen sie als Dummies 
  implementiert und auf </span>
  <span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">private</span><span style="font-size: 10pt; font-family: Arial;"> gesetzt werden.</span></li>
  <li class="MsoNormal" style="">
  <span style="font-size: 10pt; font-family: Arial;">Alle Headers m�ssen durch Definition und 
  entsprechende Abfragen von Preprocessor Macros vor Mehrfachinklusion gesch�tzt 
  werden. Das entsprechende </span>
  <span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">#define</span><span style="font-size: 10pt; font-family: Arial;"> muss der folgenden Namenskonvention entsprechen: </span>
  <span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">FILENAME_H</span><span style="font-size: 10pt; font-family: Arial;">, 
  wobei </span>
  <span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">FILENAME_H</span><span style="font-size: 10pt; font-family: Arial;"> 
  nat�rlich dem Namen der Headerdatei entspricht.</span></li>
  <li class="MsoNormal" style=""><b>
  <span style="font-size: 10pt; font-family: Arial;">Namen von Bezeichnern</span></b><span style="font-size: 10pt; font-family: Arial;"> 
  m�ssen den folgenden Konventionen gen�gen:<br>
  Klassen: </span>
  <span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">
  AlleWorteCapitalizedOhneUnderlines</span><span style="font-size: 10pt; font-family: Arial;"><br>
  Structures: </span>
  <span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">
  GleichWieKlassen</span><span style="font-size: 10pt; font-family: Arial;"><br>
  Unions: </span>
  <span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">
  GleichWieKlassen</span><span style="font-size: 10pt; font-family: Arial;"><br>
  Exceptions: </span>
  <span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">
  KlassennameEndetMitException</span><span style="font-size: 10pt; font-family: Arial;"><br>
  Methoden und Funktionen: </span>
  <span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">erstesWortKleinRestCapitalized</span><span style="font-size: 10pt; font-family: Arial;"><br>
  Konstanten: </span>
  <span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">
  GROSS_MIT_UNDERLINES</span><span style="font-size: 10pt; font-family: Arial;"><br>
  Member Variablen: </span>
  <span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">
  erstesWortKleinRestCapitalized</span><span style="font-size: 10pt; font-family: Arial;"><br>
  Lokale Variablen: </span>
  <span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">
  erstesWortKleinRestCapitalized</span></li>
  <li class="MsoNormal" style="">
  <span style="font-size: 10pt; font-family: Arial;">Neben diesen generellen Konventionen gibt es auch 
  eine spezielle Konvention, die sich auf die Semantik von Methoden bezieht:<br>
  Schreibende Zugriffsmethoden auf Member Variablen m�ssen </span>
  <span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">setXXX</span><span style="font-size: 10pt; font-family: Arial;"> 
  und ihre lesenden �quivalente </span>
  <span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">getXXX</span><span style="font-size: 10pt; font-family: Arial;"> 
  benannt werden (z.B. </span>
  <span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">setMaxUsers</span><span style="font-size: 10pt; font-family: Arial;">,
  </span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">
  getMaxUsers</span><span style="font-size: 10pt; font-family: Arial;">). Eine 
  Ausnahme dabei bilden Zugriffe auf boolsche Variablen: Hier wird die lesende 
  Methode semantisch sinnvoll mit </span>
  <span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">isXXX</span><span style="font-size: 10pt; font-family: Arial;">,
  </span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">
  hasXXX</span><span style="font-size: 10pt; font-family: Arial;">, </span>
  <span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">allowsXXX</span><span style="font-size: 10pt; font-family: Arial;"> 
  o.�. benannt (z.B. </span>
  <span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">setReadOnly</span><span style="font-size: 10pt; font-family: Arial;">,
  </span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">
  isReadOnly</span><span style="font-size: 10pt; font-family: Arial;">).</span></li>
  <li class="MsoNormal" style="">
  <span style="font-size: 10pt; font-family: Arial;">Die Struktur des Source-Codes muss den folgenden 
  Prinzipien gen�gen:</span></li>
</ul>
<p class="MsoNormal" style="text-indent: -14.2pt; margin-left: 68.2pt;">
<span style="font-size: 10pt; font-family: Symbol;">-<span style="font-family: &quot;Times New Roman&quot;; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">�����
</span></span><span style="font-size: 10pt; font-family: Arial;">Jedes File muss 
einen Header besitzen, in dem zumindest der Filename, und eine kurze 
Beschreibung des Inhalts zu finden sind. In der Praxis hat es sich eingeb�rgert, 
dass au�erdem der Name des Autors, das Erstellungsdatum, das letzte 
�nderungsdatum, eine Versionsnummer und ein Copyright-Statement im Header 
stehen.</span></p>
<p class="MsoNormal" style="text-indent: -14.2pt; margin-left: 68.2pt;">
<span style="font-size: 10pt; font-family: Symbol;">-<span style="font-family: &quot;Times New Roman&quot;; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">�����
</span></span><span style="font-size: 10pt; font-family: Arial;">Geschwungene 
Klammern f�r Code-Bl�cke m�ssen in einer eigenen Zeile stehen. Ausnahme hiervon 
sind Codebl�cke, die zu Kontrollstrukturen (Auswahl, Wiederholung) geh�ren. Bei 
diesen steht die �ffnende geschwungene Klammer in derselben Zeile wie das 
Schl�sselwort der Kontrollstruktur (</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">if</span><span style="font-size: 10pt; font-family: Arial;">, </span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">while</span><span style="font-size: 10pt; font-family: Arial;">,
</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">for</span><span style="font-size: 10pt; font-family: Arial;">, �). Die Einr�ckung der Klammern entspricht genau dem 
umschlie�enden Block. Der eingeschlossene Block selbst muss genau um 3 Spaces 
einger�ckt sein (hier sind in der Praxis Werte zwischen 2 und 4 g�ngig). 
Einr�ckungen d�rfen ausschlie�lich mit Spaces gemacht werden, Tabs sind 
verboten, denn sonst kann es mit verschiedenen Editor-Einstellungen und beim 
Drucken Probleme geben.</span></p>
<p class="MsoNormal" style="text-indent: -14.2pt; margin-left: 68.2pt;">
<span style="font-size: 10pt; font-family: Symbol;">-<span style="font-family: &quot;Times New Roman&quot;; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">�����
</span></span><span style="font-size: 10pt; font-family: Arial;">Vor jeder 
Operator-, Methoden- oder Funktionsdefinition muss in kurzen Worten beschrieben 
werden, wozu diese Funktion dient. Bei gr��eren Projekten muss auch beschrieben 
sein, was bei den einzelnen Parametern erwartet wird, welche Randbedingungen 
gelten, welche Return-Values zu erwarten sind und wie diese zu interpretieren 
sind.</span></p>
<p class="MsoNormal" style="margin-left: 54pt;">
<span style="font-size: 10pt; font-family: Arial;"></span></p>
<p class="MsoNormal" style="margin-left: 54pt;">
<span style="font-size: 10pt; font-family: Arial;"></span></p>
<p class="MsoNormal" style=""><b>
<span style="font-family: Arial;">3 ��Design Guidelines</span></b></p>
<p class="MsoNormal" style=""><b>
<span style="font-family: Arial;"></span></b></p>
<p class="MsoNormal" style="">
<span style="font-size: 10pt; font-family: Arial;">Dieser Abschnitt enth�lt einige 
generelle Richtlinien, die helfen sollen, sauberen und robusten Code zu 
schreiben.</span></p>
<ul style="margin-top: 0cm; margin-bottom: 0cm;" type="disc">
  <li class="MsoNormal" style="">
  <span style="font-size: 10pt; font-family: Arial;">Membervariablen d�rfen niemals </span>
  <span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">public</span><span style="font-size: 10pt; font-family: Arial;"> 
  zugreifbar sein.</span></li>
  <li class="MsoNormal" style="">
  <span style="font-size: 10pt; font-family: Arial;">Interne und externe Zugriffsmethoden d�rfen 
  niemals vermischt werden. Wenn Methoden zum Zugriff f�r die Au�enwelt gedacht 
  sind und entsprechend </span>
  <span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">public</span><span style="font-size: 10pt; font-family: Arial;"> zugreifbar sind, so d�rfen diese klassenintern nicht verwendet 
  werden. Wenn man beispielsweise ein Paar von Methoden </span>
  <span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">setVariable</span><span style="font-size: 10pt; font-family: Arial;">,
  </span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">
  getVariable</span><span style="font-size: 10pt; font-family: Arial;"> als </span>
  <span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">public</span><span style="font-size: 10pt; font-family: Arial;"> 
  zur Verf�gung stellt, dann d�rfen diese intern nicht f�r den Zugriff verwendet 
  werden. Stattdessen muss der direkte Zugriff auf die Membervariable erfolgen. 
  Der Grund daf�r ist einfach zu erkennen: In </span>
  <span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">public</span><span style="font-size: 10pt; font-family: Arial;"> Methoden werden alle m�glichen Schutzmechanismen 
  eingebaut, die eine Fehlverwendung ausschlie�en sollen. Man will aber eine 
  Klasse nicht vor sich selbst sch�tzen. Sollten tats�chlich auch intern 
  Methoden f�r gewisse Zugriffe ben�tigt werden, so sind diese getrennt und 
  entweder </span>
  <span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">protected</span><span style="font-size: 10pt; font-family: Arial;"> 
  oder </span>
  <span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">private</span><span style="font-size: 10pt; font-family: Arial;"> 
  zu implementieren. Durch diese Ma�nahme erreicht man eine saubere Trennung 
  zwischen dem </span>
  <span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">public</span><span style="font-size: 10pt; font-family: Arial;"> 
  Interface und der internen Implementation einer Klasse.</span></li>
  <li class="MsoNormal" style="">
  <span style="font-size: 10pt; font-family: Arial;">Seiteneffekte und unerwartetes (d.h. nicht aus 
  dem Namen ersichtliches) Verhalten von Methoden, Operatoren und Funktionen 
  sind um jeden Preis zu vermeiden!</span></li>
  <li class="MsoNormal" style="">
  <span style="font-size: 10pt; font-family: Arial;">Niemals d�rfen sogenannte silent Catches 
  implementiert werden, also Catches von Exceptions, die ganz einfach sang- und 
  klanglos ignoriert werden.</span></li>
  <li class="MsoNormal" style="">
  <span style="font-size: 10pt; font-family: Arial;">Exceptions d�rfen niemals zu Standard 
  Flow-Control Zwecken verwendet werden.</span></li>
  <li class="MsoNormal" style="">
  <span style="font-size: 10pt; font-family: Arial;">Abstrakte Methoden in Basisklassen sind unbedingt 
  solchen mit sinnlosen dummy Implementationen vorzuziehen.</span></li>
</ul>
<p class="MsoNormal"><span style="font-family: Arial;"></span></p>

</body></html>