2.3 - Producing Robust Programs

Cards (20)

  • Anticipating misuse is an important stage of development where the programmer can anticipate every possible input that users may put into a system.
    If validation or authentication cannot resolve issues, help messages and careful instruction should be used
  • Authentication is a process used to test if a person is who they claim to be
    This is done through: Passwords, PIN number or biometric methods
  • Validation is the checking of data to ensure that it is sensible, but cannot guarantee if data is correct.
  • A range check is used to check if a number input is within the allowed range
  • A type check is used to check if the data is the right type
    e.g. integer, character or text string
  • A length check is used to make sure that text entered isn't too short or too long
  • A presence check is used to make sure that data has actually been entered and a field isn't left blank
  • A format check is used to make sure the format of an input is appropriate
    e.g. email address, post code
  • Verification is the input of data twice, 2 entries are compared to see if they match, if it does, entry is accepted as valid.
  • Using subprograms can help to produce more structured code
    • Makes debugging and maintaining the program easier
    • They can be tested separately
    • Particular subprograms can be recalled several times in a code
  • Naming conventions help to identify variable names within code, having meaningful variable names also helps with readability
  • Indentation adds readability to a code and is mandatory in some languages
  • Commenting is used for yourself to explain the purpose of different sections of the program, is helpful for others reading it so they know what is happening and where
  • The purpose of testing is to ensure that for any input, the program always works correctly
  • Iterative testing is carried out using a pre-written test plan, it is used or finding errors in the program during the development stage by testing each module as they are developed.
  • Final testing is done at the end of the development stage and is used to make sure that all required functions have been included, and everything works correctly when data has been entered
  • A syntax error occurs when the grammatical rules of the language have been broken.
  • A logic error occurs when the program works but does not give the expected output.
  • Types of test data which should be used includes:
    • Normal data: Typically entered data
    • Boundary data: Tests the minimum/maximum of the allowed range
    • Invalid data: Data which should not be accepted
    • Erroneous data: Non-numeric characters in a numeric field
  • Refining algorithms makes programs more efficient
    e.g. using a flag in a bubble sort to indicate when there have been no swaps in a single pass