Defensive design considerations

The purpose of defensive design is to ensure that a program runs correctly and continues to run no matter what actions a user takes. This is done through planning for all possibilities (contingencies) and thinking about what a user may do that the program does not expect.

Defensive design encompasses three areas:

  • protection against unexpected user inputs or actions, such as a user entering a letter where a number was expected
  • maintainability - ensuring code is readable and understandable
  • minimising/removing bugs

This anticipation and protection is done through:

Defensive design is contingency planning using validation, sanitisation, authentication, maintenance and testing.