Producing robust programs Flashcards
what is the purpose of defensive design? (3)
-protection against unexpected user inputs or actions,
-maintainability ( ensuring code is readable and understandable)
-minimising/removing bugs
what are the 5 forms of validation?
-Range check - the input must fall within a specified range.
-Length check - the input must not be too long or too short.
-Presence check - a data value must be entered.
-Format check - the data must be in the correct format
-Type check - the data must be of a specified data type
what is the purpose of authentication?
to ensure that the user is who they say they are
what is the purpose of maintability?
to ensure that a program can be easily maintained
what are the 4 ways of maintability?
sub programs
commenting
indents
sensible variable names
what does commenting do?
provide information about what the different parts of the program do
what should a variable name reflect the purpose of?
variable name should reflect the purpose of the variable and the type of data that it is intended to hold
why is indentation useful?
easily see which code falls within the selection or iteration, and where it ends.
what are the two types of programming errors?
syntax and logic
what is a syntax error?
when code written does not follow the rules of the programming language
what is a logic error? what happens to the program because of it?
error in the way a program works. The program simply does not do what it is expected to do.
what is the purpose of testing?
help the programmer remove such bugs and to ensure that the program functions as intended
what are the 2 forms of testing?
iterative and terminal
when is iterative testing carried out?
what does a programmer do in this process?
-carried out while a program is being developed.
-programmer writes a section of code (module) then tests it.
when is terminal testing carried out? why?
-when all modules are complete and the program is tested as a whole to ensure that it functions as it should.