Topic 7 · Algorithm design and problem-solving
The program development life cycle
Analysis, design, coding, and testing, and how decomposition and structure diagrams break a big problem into small ones.
Four stages
Programs are built in stages. Each stage feeds the next, and testing often sends you back to fix the design or code.
- 1AnalysisUnderstand the problem: abstraction, decomposition, and a list of requirements.
- 2DesignPlan the solution with structure diagrams, flowcharts, and pseudocode.
- 3CodingWrite the program, testing each part as you go (iterative testing).
- 4TestingRun the finished program with test data to check it works as required.
Abstraction and decomposition
Abstraction means keeping only the details that matter and ignoring the rest. A train map shows the stations and the order of stops, not the exact bends of the track.
Decomposition means breaking a problem into smaller sub-problems that are easier to solve, until each one is simple enough to code. Every computer system is made of sub-systems, which are made of further sub-systems.
When you decompose a problem, identify its inputs, processes, outputs, and storage.
Structure diagrams
A structure diagram shows decomposition as a tree. The whole system sits at the top, and each level below breaks a box into smaller parts.
- Alarm clock
- Set alarm
- Input time
- Save time
- Check time
- Read clock
- Compare
- Ring alarm
- Play sound
- Snooze
- Set alarm
Ways to design an algorithm
An algorithm is a set of steps that solves a problem. You can write the same algorithm in three ways:
- Structure diagram: shows how the problem is broken down, but not the order of steps.
- Flowchart: shows the steps and decisions as connected shapes.
- Pseudocode: a structured, language-neutral way to write the steps, close to real code.
Exam tip. Next: the flowcharts lesson shows every flowchart symbol. The programming topic covers pseudocode in detail.
Key terms
- Abstraction
- Removing unnecessary details to focus on what matters.
- Decomposition
- Breaking a problem into smaller sub-problems.
- Structure diagram
- A tree diagram showing how a system is broken into sub-systems.
- Algorithm
- A sequence of steps to solve a problem.
Check yourself
Name the four stages of the program development life cycle.Show answer
Analysis, design, coding, testing.
In which stage are structure diagrams and flowcharts produced?Show answer
Design.
What is the difference between abstraction and decomposition?Show answer
Abstraction removes unnecessary detail. Decomposition breaks the problem into smaller parts.