Make your own free website on
Writing Solid Code

Writing Solid Code

Here is a checklist of stuff to keep in mind while writing software.

For every bug/defect reported:

  1.   How could I have 'automatically' detected this bug?
  2.   How could I have 'prevented' this bug?
  3.   Enable all optional compiler warnings.
  4.   Strengthen your prototypes ( const, unsigned, etc).
  5.   Use LINT to catch bugs.
  6.   If you have unit tests, run them.
  7.   Use assertions to validate function arguments.
  8.   Strip undefined behaviour from your code or use assertions to catch illegal uses of undefined behaviour.
  9.   Comment unclear assertions.
  10.   Assert or remove all assumptions.
  11.   Use assertions to detect impossible conditions.
  12.   Don't hide bugs when you program defensively.
  13.   Use a second algorithm to validate your results.