Skip to content

Clean Code Guideline

rdunker edited this page Aug 4, 2021 · 6 revisions

Clean Code Guideline

In order to archive a consistent code style we follow these general rules:

Naming

  • Choose descriptive names
  • Capitalize class names, global variables, pool dictionaries, and class variables
  • Use Camel-Case
  • Parameter-Names should start with a or an a (e.g. aMNMusicObject) - we let this unchanged in legacy code
  • Parameter-Names should be descriptive (e.g. not anObject) - we let this unchanged in legacy code
  • Do not use "magic numbers" in an expression

Formatting

  • No blank line after the method name (because it was handled like this in the legacy code)
  • Insert a dot at the end of a statement, unless it is a return statement
  • Leave one blank before a left parenthesis and after a right parenthesis
  • Leave one blank after but not before a comma, a semicolon, and a colon in a selector
  • Use Cascades whenever possible
  • Only use parenthesis if necessary

Instance Variables

  • Only set and read instance variables by accessor methods
Clone this wiki locally