Revise Computingrevisecomputing.co.uk
At a glanceFeaturesStudentsPricingHow it worksFree GCSE notesExam dates
At a glanceFeaturesStudentsPricingHow it worksFree GCSE notesExam dates

Knowledge organisers / Testing

Refining algorithms

All topicsPractise exam questions
Knowledge organiser

Testing

2.3.2e

Ability to correct an algorithm based upon identifying syntax or logic errors.

What you need to know

Refining an algorithm means improving it after it has been designed and tested. This could involve fixing bugs found during testing, adding new functionality, improving efficiency by removing unnecessary steps, or making the code more readable. Refining is an ongoing process throughout the software development cycle.

Key points

  • Refining means improving an algorithm or program after initial development and testing.
  • Common refinements: fixing bugs, improving efficiency, adding functionality.
  • Removing unnecessary/repeated code makes programs more efficient.
  • Improving variable names and adding comments improves readability.
  • Refining is driven by the results of testing: fix issues found with test data.
  • You may be asked to identify improvements or correct errors in a given algorithm.
  • Exam Example:Replacing 5 repeated lines (total = total + minsPlayed[2,0] ... minsPlayed[2,4]) with a FOR loop: for x = 0 to 4: total = total + minsPlayed[2, x] — more efficient and maintainable.
  • Exam Tip:Refining to use a function means replacing inline code with a function call: totalPay = calculatePay(experience, miles).
  • Exam Tip:When asked to 'refine' a program with errors, you must fix ALL syntax AND logic errors. Check: correct operators (AND not OR), correct comparisons (<=, not =<), string delimiters on print strings, output messages in the right position.