2.3. Producing Robust Programs

Cards (28)

  • What is misuse?

    Using the program in a way that was not intended - they could be accidental or deliberate, but code must be written to stop misuse.
  • What is an example of misuse?

    Guessing a password too many times in a row.
  • What is authentication?

    Method of ensuring someone is who they claim to be, allowing them to access things - they can be usernames and passwords, biometrics, captcha and more.
  • What is validation?

    Placing rules on entered data to ensure it is sensible, minimising the number of mistakes users make.
  • What are the kinds of checks in validation?
    • Presence check
    • Length check
    • Range check
    • Type check
    • Format check
  • What is a presence check?

    Making sure a value is entered and not left blank.
  • What is a length check?

    Making sure a data is a required minimum or maximum length.
  • What is a range check?

    Making sure a data is within a given set of boundaries.
  • What is a type check?

    Making sure data is of the correct data type.
  • What is a format check?

    Making sure the data follows a set pattern.
  • What is a whitelist in validation?

    A list of allowed data.
  • What is a blacklist in validation?

    List of data not allowed.
  • What is maintenance?

    Keeping programs running properly, such as correcting bugs and changing programs when needed.
  • What are some things that make maintenance easier?
    • Sub routines
    • Naming conventions
    • Comments
    • Indentations
  • How can subroutines help maintenance?

    It makes it easier as each one can be tested and changed separately, and makes code easier to follow.
  • How is sensible naming beneficial for maintenance?

    It makes it easier for someone else to identify and follow code.
  • How can comments help maintenance?

    They make sure someone else can understand what the code is supposed to do.
  • How can indentations help maintenance?

    They layout code so it is easier to follow.
  • What are the kinds of tests?
    • Iterative testing
    • Final testing
  • What are the purposes of testing?

    • Makes sure program meets user requirements
    • Checks program works correctly
    • Finds any bugs present and allows them to be fixed
    • Ensures user likes how it works
    • Checks that security works
  • What is iterative testing?

    Test that happens during development - programmer checks that code works as they're making it - each module is tested separately.
  • What is final testing?

    A test at the end of development - the user tests the whole program to see if they're happy with it.
  • Why is careful data testing needed?

    To make sure nothing is left untested.
  • What is normal data?

    Data that should work and produce a correct result.
  • What is invalid or erroneous data?

    Data that shouldn't work - system should be able to deal with it without crashing.
  • What is boundary data?

    Data at the edges of a range - ensures boundaries are correctly set.
  • What is defensive design?

    Any method that is added into the program to ensure it runs correctly without misuse.
  • What are examples of defensive design?

    Authentications and validations.