Producing Robust Programs Flashcards
What are defensive design considerations?
Anticipating misuse, validation, verification, authentication, maintainable code
Input validation
A process to check that data is reasonable before it is accepted.
What is Range check?
Checks data within a certain range.
Whats type check?
Checks data is a certain data type.
Whats prescence check?
checks that data has been entered and not left blanck
Whats lookup table?
A table of acceptable entries, also known as a list
Maintainability
Programs should be written in a way that makes maintaining and understanding them straightforward.
Examples of maintainability
Using subprograms to reuse code and make them easier to test
Appropriate variable names
Using indentation to improve readability
Comments enable a programmer to understand the purpose of each line of code
Using constants to keep code consistent and easier to read and debug
Whats the purpose of testing?
To ensure that a program works correctly no matter what the user has input.
Also to ensure the user requirements have been met, errors have been removed and the program doesn’t crash while running
Iterative testing
Takes place during program development
The programmer develops a module, tests it and repeats this process until the module works as expected
Final testing
Also known as terminal testing
Takes place after development and before the program is released to the end user
Takes place once all modules have been individually tested to ensure the whole program works as expected
Syntax error
A mistake in the grammatical rules of the programming language, e.g. incorrect spelling of a command word or print(“hello”(
Logical error
A mistake made by the programmer. Program runs without crashing but will display the wrong answer e.g. incorrect calculatioon symbol
What are the four types of test data?
Normal data
Boundary data
Invalid data
Erroneous data (data of wrong type that program cannot process and wouldn’t accept)