Producing robust programs

  • Created by: 15j.price
  • Created on: 17-05-19 09:13
View mindmap
  • Producing robust programs
    • Input sanitisation and validation
      • anticipating misuse
        • put yourself into the mind of your users and make the system as simple to use as possible. use menus or short codes rather than entire words to cut down on potential spelling errors. if possible, make sure it is not case sensitive
      • planning for contingencies
        • what happens if it goes wrong? what error message do you want to appear?
      • authentication
        • ensuring only users who have the right to use that program can have access to it. use email checks, passwords etc.
    • Testing
      • a programmer must thoroughly test their program to spot syntax and logic errors and correct them. this is usually done in 2 stages:
        • final / terminal testing
          • carried out when all sections of the program is complete. the program is tested by running through it several times to test out different scenarios
        • iterative testing
          • carried out while a program is being developed. the programmer writes a section of code then tests it
    • Validation checks
      • presence check
        • a data value must be entered
          • for example, entering a quantity when placing an order
      • length check
        • the input must not be too long or too short
          • for example, a surname will require at least one letter, but is unlikely to require more than 40
      • format check
        • the data must be in the correct format
          • for example, entering a date in the format DD/MM/YYYY
      • range check
        • the input must fall within a specified range. this is usually applied to numbers and dates but can apply to characters
          • for example, when making a payment to someone the amount to be entered might be set to be greater than 0 and not greater than the funds available
      • type check
        • the data must be of a specified data type
          • for example, an integer when specifying a quantity
    • Errors
      • logic
        • a problem with the way a problem works and he route it will follow through a program. logic errors can have many causes, such as:
          • incorrectly using brackets in calculations
          • unintentionally creating a situation where a loop will keep repeating and it cannot break out of it; this is known as an infinite loop
          • unintentionally using the same variable name at different points in the program for different purposes
          • incorrectly using logical operators, e.g. expecting a program to stop when the value of a variable reaches 5, but using < 5 instead of< = 5
      • syntax
        • occurs when a code does not follow the rules of the programming language, this includes:
          • misspelling a word e.g. writing "iput" instead of "input"
          • using a variable in a statement before it has been created or declared
          • missing brackets, speech marks to another grammatical error that code will be expecting etc.
    • Maintainability
      • ensuring other programmers can make sense of the program you have written
      • code within sub programs or iterations should be indented. some programs will not run unless correct indentation is used
      • you should select variable names that reflect the purpose or contents rather than short difficult to understand abbreviations
      • comments provide information about what the different parts of the program do
    • Selecting and using suitable test data
      • extreme data and range check
        • valid data that falls at the boundary of any possible ranges
      • valid data
        • sensible, possible data that the program should accept and be able to process
      • invalid (erroneous) data
        • data that the program cannot process and should not accept


No comments have yet been made

Similar Computing resources:

See all Computing resources »See all Programming resources »