Five habits that help code quality

  • Write unit tests to save you from regression bugs. Unit tests also force you to write code that is less tightly coupled and more logically factored.
  • Keep coupling to a minimum.
  • Apply the Principle of Least Astonishment - design components of your system in a way that they behave how people using your system expect them to behave.
  • Minimise cyclomatic complexity - number of independent paths through a given piece of code.
  • Write clear, unambiguous, self-explanatory names to minimise confusion.

Full post here, 6 mins read