How to code well

I have a few principles about how to code.

  1. Reusability
    whenever a piece of code is repeated, it is to be set aside in either a sub-routine, a function or a class (whichever fits the purpose) so that it can be re-used and only needs to be updated once.
  2. Presentation
    clearly laid out code with appropriate indenting, groups and comments is easier to understand and debug.
  3. Conciseness
    short code is easier to manage and less prone to errors.

Teamwork

My aim is to write code that I would like to pick up from another programmer. Writing good code is about teamwork, whether the other programmers are working on my code at the same time as I am or after I'm done with it.

Cost effectiveness

The time and money spent on a piece of programming should be at least a medium-term investment. Code that needs to be re-written less than a year after its initial release or when a new developer picks it up is a waste of money.

Flower