Code Quality

In order to help you write better source code there are some basics to follow.
The list below does not claim to be complete.

DRY - Don’t repeat yourself

The DRY principle for developing good software is to reduce repetition of code fragments, e.g. methods, parameter definitions. Instead, repetitions can be replaced with abstractions or by using data normalization to get rid of redundancy.
In other words, we do not copy things into classes multiple times, instead we use an abstract or super class holding these methods.

Separation of Concerns

Keep your contexts clean. As an example, a communication class does not need to know about configuration parameters concerning sensors or motors.
So, Separation of Concern is about separation of source code into distinct and independent sections.

Readable and Maintainable Source Code

In order to keep your source code readable and maintainable you can follow these hints.

  • Write "speaking" (talkative) source code

    • Name your methods, variables so that others understand what is happening

  • Comment your code: Use Docblocks and line comments to give others an understanding of what your source code should do

  • Avoid monolithic files and classes with lots of dependencies