Defensive Design Flashcards
(16 cards)
What is the purpose of defensive design?
Ensure a program is secure and robust
Name the 6 defensive design considerations
Anticipating misuse, input sanitisation, validation, verification, authentication, maintainable code
What is validation?
Process to check that data is reasonable or sensible before it is accepted
What is a range check?
Checks data is within a certain range
What is a type check?
Checks data is a certain type
What is a format check?
Checks data is entered in a certain way
What is a presence check?
Checks that data has actually been entered and not left blank
What is a lookup table?
A table of acceptable entries, also known as a list
What is a length check?
Checks the length of the input is within a certain amount
What is maintainability and why should it be used?
Programs should be written in a way that makes maintaining and understanding them as straightforward as possible
List the 5 ways of keeping maintainability in a program
Subprograms (modularisation), appropriate variable names, indentation, comments, constants
Modularisation
Using subprograms to reuse code and make them easier to test
Indentation
Improves readability and clearly shows each ‘block’ of code
Comments
Enable a programmer to understand the purpose of each line of code; it is crucial when working in a team
Appropriate variable names
Using a naming convention ensures the purpose of a variable is immediately understood
Constants
Keeps the program code consistent, which makes it easier to read and debug a program