GCSE Computer Science (WJEC)

Topic Summaries

ALGORITHMS AND PROGRAMMING: Producing robust programs

Maintainability

  • Maintainable code is easy to read, update, and debug – even by someone else.
  • Use of subprograms:
    • Break code into functions or procedures.
    • Each does one clear task. 
    • Makes the code reusable and easier to test.

def get_user_input():

name = input(“Enter your name:”)

return name

  • Naming conventions:
    • Use meaningful names for:
      • Variables (user_name, total_score)
      • Subprograms (calculate_tax, check_password)
    • Avoid: x, abc, thing1 (unless used temporarily or in loops).
  • Indentation:
    • Shows which code belongs inside loops, conditions, or subprograms.
    • Python requires indentation (usually 4 spaces).
    • Helps with logic clarity and avoiding syntax errors.

if score > 10:

print(“High score”)

  • Commenting:
    • Comments explain the code, especially what it does and why something was done a certain way.
    • Good comments help other programmers (and your future self).

# To calculate total price with tax

def calculate_total(price):

return price * 1.2

Unlock Maintainability

Sign up to unlock the rest of this topic — plus every other topic, video, flashcard set and eBook guide in your SnapRevise Digital subscription.

Cancel anytime — instant access the moment you sign up.