Skip to content

Commit 202a8cd

Browse files
authored
Merge pull request #9 from ManticSic/translate_cgc16000
Translate GCG16000
2 parents 8311ec0 + 6951fa1 commit 202a8cd

File tree

1 file changed

+35
-40
lines changed
  • coding-guidelines/docs/guidelines/general

1 file changed

+35
-40
lines changed
Lines changed: 35 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,39 @@
1-
**en Translation coming soon**
1+
# Documentation
22

3-
# Dokumentation
3+
## Write comments in US English (CGC16001) <img src="/img/1.png" alt="recommendation level 1" />
44

5-
## Verwende US Englisch für Kommentare (CGC16001) <img src="/img/1.png" alt="recommendation level 1" />
6-
7-
## Verwende US Englisch für Dokumentation (CGC16002) <img src="/img/1.png" alt="recommendation level 1" />
5+
## Write code documentation in US English (CGC16002) <img src="/img/1.png" alt="recommendation level 1" />
86

97
## Dokumentiere alle von außerhalb verfügbaren Typen und Members (CGC16003) <img src="/img/2.png" alt="recommendation level 2" />
10-
Alle Typen und Members, die von außerhalb des Programmes, aber auch außerhalb
11-
Namespaces, Paketen oder Typen innerhalb des Programmes erreichbar sind, sollten
12-
mit, für die jeweilige Sprache standardisierte Style, dokumentiert werden. Auf
13-
diesen Weg können andere Entwickler den Verwendungszweck und die Verwendung
14-
verstehen, ohne den eigentlichen Code zu kennen.
15-
16-
Außerdem ist es möglich, mit entsprechenden Tools, eine professionell aussehende
17-
Dokumentation zu erstellen.
18-
19-
## Schreibe Dokumentation für andere (CGC16004) <img src="/img/2.png" alt="recommendation level 2" />
20-
Dokumentation sollte für Nutzer geschrieben werden, die den dahinterstehenden
21-
Code nicht kennen. Sowohl der Verwendungszweck als auch die Verwendung sollte
22-
klar erklärt werden, um die bestmögliche Verwendung sicherzustellen.
23-
24-
## Vermeide Inline-Kommentare (CGC16005) <img src="/img/2.png" alt="recommendation level 2" />
25-
Wenn Inline-Kommentare nötig sind, sollte es in betracht gezogen werden, ob
26-
es besser wäre, den betroffenen Code in eine eigene Methode mit einem
27-
aussagekräftigen Namen auszulagern.
28-
29-
## Verwende keine Kommentare, um zukünftige Aufgaben festzuhalten (CGC16006) <img src="/img/2.png" alt="recommendation level 2" />
30-
Es ist gut, wenn Arbeit, die aktuell nicht erledigt werden konnte, festzuhalten,
31-
allerdings sollte dies in einem Projektmanagementsystem erfolgen. Die Verwendung
32-
von `TODO`-Kommentare ist zwar auch eine Möglichkeit, allerdings wird in der
33-
Praxis nicht oder nur selten nach solchen Kommentaren gesucht und gelöst.
34-
35-
Eine weitere Möglichkeit ist eine Kombination aus beiden. Ein Ticket in dem
36-
jeweiligen Projektmanagementsystem anlegen und ein dazugehöriges
37-
`TODO`-Kommentar anlegen und in diesem das Ticket referenzieren.
38-
39-
## Schreib Kommentare um komplexe Algorithmen oder Entscheidungen zu erklären (CGC16007) <img src="/img/1.png" alt="recommendation level 1" />
40-
Kommentare sollten sich auf das `Was?` und `Warum?` konzentrieren, statt auf dem
41-
`Wie?`. Die Statements sollten nicht Zeile für Zeile erklärt werden, sondern es
42-
sollte das Ziel erklärt werden, und weshalb genau diese Lösung verwendet wurde,
43-
wenn sie einer offensichtlicheren vorgezogen wurde, z. B. welche Probleme
44-
dadurch vermieden werden.
8+
Documenting all types and members, which are accessible from outside (assembly,
9+
namespace, class, …). Use the common way to document that kind of code,
10+
depending on your programming language (javadoc for java, XMLDoc for .Net and so
11+
on). This way other developers can get the most out of your function without
12+
knowing the concrete implementation.
13+
14+
Furthermore, you can use tools to create professionally looking documentation.
15+
16+
## Write documentation with other in mind (CGC16004) <img src="/img/2.png" alt="recommendation level 2" />
17+
Write the documentation with other in mind. Assume they will not have access to
18+
the full source, the requirements and specifications, so try to explain how to
19+
get the most of the functionality of your code.
20+
21+
## Avoid inline comments (CGC16005) <img src="/img/2.png" alt="recommendation level 2" />
22+
If you feel the need to explain a block of code using a comment, consider
23+
replacing that block with a method with a clear name.
24+
25+
## Don't use comments for tracking work to be done later (CGC16006) <img src="/img/2.png" alt="recommendation level 2" />
26+
Annotating a block of code or some work to be done using a `TODO` or similar
27+
comment may seem a reasonable way of tracking work-to-be-done. In reality,
28+
nobody really searches for comments like that. Use a project management system
29+
to keep track of leftovers.
30+
31+
Another way is a combination of the usage of a work item in a project management
32+
system, and a related `TODO` comment, with a reference to that work item.
33+
34+
## Only write comments to explain complex algorithms or decisions (CGC16007) <img src="/img/1.png" alt="recommendation level 1" />
35+
Try to focus comments on the *why* and *what* of a code block and not the *how*.
36+
Avoid explaining the statements in words, but instead help the reader understand
37+
why you chose a certain solution or algorithm and what you are trying to
38+
achieve. If applicable, also mention that you chose an alternative solution
39+
because you ran into a problem with the obvious solution.

0 commit comments

Comments
 (0)