National 5 – Testing and documenting solutions (Revision)

Test Data

For an exam out of 100

  • Normal (data within expected range) – 78, 45,67, 85, 44
  • Extreme (data at limits of expected range)– 0, 100
  • Exceptional (data out with expected range) – -89, bob

Errors

  • Syntax – The rules of the programming language have been broken. E.g. a typing mistake Displya rather than Display
  • Execution – using Average = total / 0 would give an execution error.
  • Logic –will only show up when you run the program. Please see below

counter = 0
while counter < 0:
counter = counter + 1

Readability of code

  • Internal commentary – information about what the program does written by the programmer alongside the actual code. #Green in python.
  • Meaningful identifiers – Calling variable names that mean something length or height rather than L or H
  • Indentation starting parts of the code slightly into the middle of the page making it easier to read.

Leave a Reply

Your email address will not be published. Required fields are marked *