Design a site like this with WordPress.com
Get started

Defensive Designing

Programmers have to protect their program through defensive designing.

Their code has to be well maintained

Have to reduce number of bugs/errors

Think of all possible ways the user could misuse their program

Input Sanitisation is removing any unwanted characters before passing data through the program.

Input Validation is checking that the data entered meets a certain criteria before passing data through the program.

Range Check Checking that the data is within a certain range
Presence CheckChecking that the data has actually been entered
Check digitChecking that the numerical values have been added correctly.
Look-Up-TableChecking the data across a list of suitable values.
Format CheckChecking that the data is within the correct format
Length CheckChecking that the data is in the correct length

Authentication is used in order to verify the user’s identity before they are allowed access. This can be verified through various ways such as: Passwords

You can:

  1. Force the User to only have strong passwords.
  2. Force the User to type in certain characters of their password
  3. Limit the number of failed authentication attempts before account is locked.

Code should be EASY TO MAINTIAN

COMMENTS – There should be comments all over your code in order to explain your code’s purpose to another developer/programmer. They should be well-written and clear.

INDENTATION – Your code should be indented to clearly sperate statements, makes the code easier to read and understand for developers/programmers.

VARIABLES – Your code cannot have a random name assigned to a variable or a subprogram such as ‘xyz’ or ‘newVariable’. Something such as ‘userName’ or ‘timeDelay’ would be much more easier to keep track of and understandable for developers/programmers.

By Anshjeet Singh

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: