Learn in your language
Skip to content
IGCSE · Cambridge (CIE) · 0478

Make a program maintainable

Use meaningful identifiers, comments and reusable routines so another person can follow and update a program.

Section 8 · Programming

Cambridge IGCSE Computer Science 0478 · Programming · 2026–2028 Version 6 · 8.1
Exam scope and assessment notes

This sequence follows Cambridge IGCSE Computer Science 0478, 2026–2028 syllabus Version 6. It covers section 8.1 (Programming concepts) only. Pseudocode examples use the published Cambridge format; the separate 2029–2031 syllabus is not mapped here. Practice is original, self-checked and does not award an official Cambridge grade. Full timed papers, a browser-based programming workspace and human subject-teacher review remain outstanding.

Before you begin

  • Be comfortable following an ordered algorithm and tracing variable values. Each lesson introduces the Cambridge pseudocode form it uses.

Work on paper. Try each question before revealing help, and explain why your method works.

Quick readiness check

Why are comments useful?

What you will learn

  • Choose meaningful names for program elements
  • Add relevant comments
  • Use procedures and functions to keep work organised

Names communicate purpose

Use meaningful identifiers for variables, constants, arrays, procedures and functions. A name such as CalculateAverage is easier to understand than P2.

Consistent names help a reader connect a variable to the requirement it represents. Keep names precise and avoid changing terminology between related sections.

Comments should explain relevant decisions

Use the language's commenting feature for reasons, assumptions or non-obvious steps. A comment that merely repeats the next line adds little.

Reusable procedures and functions reduce duplicated logic. When a rule changes, one well-named routine is easier to update than several copied blocks.

Pause and explain

A 10-line calculation appears in four places. What helps maintainability?

Put the idea to work

Worked example

Improve the maintainability of a program that uses X, Y and repeated calculations of tax.

Show the worked solution
  1. Rename X and Y to describe their data.
  2. Move the repeated tax calculation into a named function.
  3. Comment the tax rule if the reason or assumption is not obvious.

Answer Use identifiers such as TaxableIncome and TaxAmount, call CalculateTax, and document the rule that determines the rate.

Try a topic test

Choose Easy, Normal or Difficult. Save your answers and open worked review after finishing.

Test this topic →

From guided practice to a new situation

Write your answer and reasoning first. Use a hint only if you are stuck. The model solution is for self-checking; your written work is not automatically marked.

1 · Guided

Suggest clearer names for A, B and C when they store a unit price, quantity and total cost.

Give me a hint

Choose identifiers that describe each value.

Compare my reasoning
  1. A becomes UnitPrice.
  2. B becomes Quantity.
  3. C becomes TotalCost.

Use UnitPrice, Quantity and TotalCost.

Look for these in your work

  • Each name describes its purpose
  • Names remain distinct
2 · Independent

A line says Total ← Price * Quantity. Write a useful comment that adds information instead of repeating the line.

Give me a hint

Explain an assumption or rule that is not visible in the expression.

Compare my reasoning
  1. State what Price includes or how Quantity is interpreted.
  2. Keep the comment relevant to the calculation.
  3. Avoid merely saying the line calculates Total.

For example: // Price is the pre-tax price for one item.

Look for these in your work

  • Additional context
  • Relevant explanation
3 · Transfer

Two copied price-calculation blocks now use different tax rates by mistake. Describe a maintainable correction.

Give me a hint

Reduce duplicated logic and verify the rule in one place.

Compare my reasoning
  1. Create one CalculateTotalPrice routine.
  2. Pass the price and applicable rate explicitly.
  3. Replace both copied blocks with calls and test both scenarios.

Centralise the calculation in one named routine, pass the needed values, and test each rate case.

Look for these in your work

  • Reuse introduced
  • Inputs explicit
  • Scenarios retested

Common mistakes

  • Adding comments that repeat every line verbatim
  • Using one-letter names for important data
  • Copying the same calculation into multiple places
Recall without your notes

What can you explain now?

Which change most improves a variable name?

Compare with the explanation

Replace X with a name such as NumberOfAttempts

A meaningful identifier describes the value's purpose.

After trying it yourself, choose your next review. This is your self-assessment.

Your review choice appears on Today. Sign in to sync it across devices.

Make it stick

How do meaningful identifiers and reusable routines make a program easier to update?

If you needed the solution, close it and solve the problem again from a blank page. A correct answer is stronger when you can explain the reason for each step.

Keep learning Computer Science

Course scope and assessment

165 original lessons map the listed objectives across all 10 main topics in the 2026–2028 Version 6 syllabus, with worked explanations and guided, independent and transfer practice. This is mapped teaching coverage, not proof of full exam readiness. Three earlier starter lessons remain available but are not counted as syllabus-mapped teaching. Practical programming experience in an executable browser workspace, full timed-paper practice, human subject-teacher review and the separate 2029–2031 syllabus remain outstanding. Practice is self-checked and does not award an official Cambridge grade.

StudyForA · Learn with understanding

Original teaching content and links to official sources. Check your exam year and qualification before using a resource.