Skip to main content
EnglandComputer ScienceSyllabus dot point

How do you develop, read, refine and debug a program, and write readable code?

Use decomposition and abstraction to solve problems; read, write, analyse and refine programs; convert algorithms (flowcharts, pseudocode) into programs; use techniques (layout, indentation, comments, meaningful identifiers, white space) for readable code; identify, locate and correct logic, syntax and runtime errors; and evaluate a program's fitness for purpose and efficiency.

A focused answer to Edexcel GCSE Computer Science 6.1, covering using decomposition and abstraction in programs, converting algorithms to code, writing readable code, identifying and correcting errors, and evaluating fitness for purpose.

Generated by Claude Opus 4.89 min answer

Reviewed by: AI editorial process; not yet individually human-reviewed

Have a quick question? Jump to the Q&A page

Jump to a section
  1. What this dot point is asking
  2. From problem to program
  3. Writing readable, maintainable code
  4. Finding and fixing errors
  5. Evaluating a program
  6. Try this

What this dot point is asking

Edexcel wants you to develop programs well: use decomposition and abstraction, turn algorithms into code, write readable, maintainable code, find and fix errors (logic, syntax, runtime), and evaluate a program's fitness for purpose and efficiency. This underpins the whole of Paper 2, which is written in Python 3.

From problem to program

This is the same computational thinking from Topic 1, now applied to writing real code. A decomposed design means you can write and test one subprogram at a time. Converting an algorithm to code is a direct translation: a "repeat 10 times" step becomes a for loop, an "if the score is high" step becomes an if statement, and so on. Doing the design first makes the coding faster and the result clearer.

Writing readable, maintainable code

These techniques matter because programs are read far more often than they are written, by other people and by you months later. Meaningful identifiers make code self-explanatory; comments explain anything non-obvious; indentation and white space reveal the structure at a glance. In Python, indentation is not optional, it defines which statements are inside a loop or if, so getting it right is essential to both correctness and readability.

# Calculate the average of a list of marks
total = 0
for mark in marks:
    total = total + mark
average = total / len(marks)
print(average)

The comment, clear names (total, average, marks) and indentation make this easy to follow.

Finding and fixing errors

You locate errors differently by type. Syntax errors are reported by the interpreter, which usually points to the line, so they are quick to fix. Runtime errors appear for certain inputs and produce an error message at the point of failure, so you test with a range of data to trigger them. Logic errors are the hardest because the program runs without complaint, so you use a trace table and test data with known expected results to find where the output goes wrong, then correct the algorithm.

Evaluating a program

Evaluation is what turns working code into good code. Testing with normal, boundary and erroneous data checks fitness for purpose; thinking about how many comparisons or loop passes the program makes, and how much memory it uses, checks efficiency. Refining then acts on what you find, fixing faults, tidying the code, or making it more efficient.

Try this

Q1. State the type of error caused by a missing colon at the end of a Python if statement. [1 mark]

  • Cue. A syntax error.

Q2. State one technique that makes code easier to read. [1 mark]

  • Cue. Any one of: meaningful identifiers; comments; indentation; white space; sensible layout.

Exam-style practice questions

Practice questions written in the style of Pearson Edexcel exam questions on this dot point, with worked answer explainers. The year tag is the paper they imitate, not the source.

Edexcel 20224 marksA program contains the line below, which should print whether a number is positive. Identify the error, state its type, and write the corrected line. if number > 0 print('positive')
Show worked answer →

The error is a missing colon at the end of the if statement; in Python an if line must end with a colon.

This is a syntax error, because it breaks the rules of the language, so the program will not run.

The corrected line is:

if number > 0:
    print('positive')

Markers reward identifying the missing colon, classifying it as a syntax error (breaks the language rules so it will not run), and giving the corrected code with the colon.

Edexcel 20214 marksDescribe two techniques a programmer can use to make a program easier to read and maintain, and explain why each helps.
Show worked answer →

Choose two techniques and explain the benefit.

Meaningful identifiers: giving variables and subprograms descriptive names (such as total_score rather than t) makes the code self-explanatory, so a reader can understand what each part does without extra effort.

Comments: adding notes that explain what a section of code does or why, which helps another programmer (or the same one later) understand and safely change the code.

(Indentation and white space, which show the structure and group related code, are alternatives.)

Markers reward two techniques (meaningful identifiers, comments, indentation, white space, sensible layout) each with a developed reason about readability or maintainability.

Related dot points

Sources & how we know this