Producing Robust Programs (2.3) Flashcards
1
Q
What is input sanitisation
A
- to clean up input data, removing any unwanted data such as extra spaces, or removing special characters/symbols. This also helps prevent SQL injection.
2
Q
What is validation
A
- validating the data entered so that it fits a range of values, or is of a specific type. Entered data must fit criteria to prevent logical errors and unexpected outcomes
3
Q
What is authentication
A
- only allowing authorised users to access data through use of usernames and passwords etc.
4
Q
What is maintainable code
A
- this allows other programmers to also understand the code, especially when dealing with large programs
5
Q
What 4 ways can maintain code
A
- Comments : annotating the code to make it easier to understand and read
- Indentation : spacing the code appropriately, so it is easily to follow different sections of the program and what they do
- Meaningful identifier names : using appropriate names for identifiers (variables, constants etc.) linked to the purpose so it does not cause confusion
- Use of sub-programs :
allows programmer to structure code so parts can be developed and changed independently without affecting the rest of the program
6
Q
Why do you test your code
A
- Testing allows the programmer to test the function of programs to make sure they work as expected
7
Q
What is iterative testing
A
- carried out while the program is being developed (ongoing) so different sections of code are tested out by the programmer
8
Q
What is Final/Terminal testing
A
- carried out when all the sections of the program and code have been completed and developed. The program is tested as a whole to make sure it functions as expected.
9
Q
What is normal test data
A
- selecting valid/expected values to see if the program accepts these without causing errors e.g. if the valid numbers are 1-10 then choose a number within this range
10
Q
What is Invalid/Erroneous test data
A
- selecting data which the program should not accept such as entering “six” as string instead of 6 as integer so it should be rejected
11
Q
What is boundary test data
A
- selecting values which lie on the boundary of the accepted range of values e.g. if 1-10 are valid values then entering 0,1,10,11 are boundary data