Code Comments
Code is not only for the computer, but it should be readable for humans, too. Up-to-date code comments are essential to make code understandable for others. Thus please use following techniques (in order of preference):
- Comment interfaces following design-by-contract.
- You should also add assertions to state what should be true at a specific position in the code. Advantage: Syntax is checked and they are automatically verified at run-time. So they are not only useful for people reading the code but also for tools. Note: Do not use assert for user-APIs, always handle arguments of user-APIs like untrusted input.
- If the "comment" might be useful to be printed during execution, use logging.
- Otherwise comment within source.
Use
TODOto indicate that something is not yet done. Before merging, relevantTODOs should be fixed or create a left-over issue