Anticipate how users might misuse a program, then attempt to prevent it from happening
Authentication
Ensure code is well maintained
Reduce errors
Input validation
Checking is data meets certain criteria before passing it into the program, e.g. checking that an email address contains an @ symbol and has a suitable ending
Types of input validation check
Range check- Checks the data is within a specified range
Presence check- Checks that data has been entered
Format check- Checks the data has the correct format, e.g. a date
Look-up table- Checks the data against a table of acceptable values
Length check- Checks the data is the correct length
Type check- Checks data is of the right data type
Maintainability:
Using sub programs can make it easier for other programmers to see how different parts of a program work, which can help them understand the overall program faster
Maintainability
Enabling future maintenance of your program
Making it easier for future support programmers to identify and fix problems
Making it easier to extend your original program if customer has additional requirements
Maintainability:
Use comments to:
Explain the purpose of the program
Explain sections of code
Explain unusual approach's
Visually divide sections of a program
Maintainability:
Use indentation for every selection and iteration branch
Maintainability:
Use descriptive variable names using naming conventions