🎯 Syllabus & Goals 3 min
Cambridge 7.1 · Program development life cycle Paper 2 · Algorithms, Programming and Logic
By the end of this lesson you can:
- Name the four stages of the program development life cycle in order and state what happens in each.
- Describe abstraction and decomposition and apply them to a real problem.
- Explain what iterative testing is and how it differs from final testing.
Textbook: Chapter 7, §7.1 (pp. 258–259)
Recap / Warm-Up 5 min
Units 1–6 covered Paper 1: how computers store, move and process data. Unit 7 opens Paper 2. From now on you design, read and write algorithms.
Quick starter
A friend is asked to write an app for a school canteen. They open an editor and start typing code straight away. Give one thing that could go wrong.
Reveal a model answer
They may build the wrong thing, because nobody wrote down what the canteen actually needs. Or the parts they write may not fit together, because there was no plan. The life cycle exists to stop both.
🧠 Key Concept 14 min
1 · Four stages, always in the same order
Programs are not written in one go. Developers follow the program development life cycle (PDLC). Cambridge examines four stages: analysis, design, coding and testing.
2 · Analysis — what exactly is the problem?
Before anything is solved, the problem must be defined clearly so everybody understands what is needed. The result is a requirements specification. Two tools help at this stage.
3 · Design — how will it be solved?
Design uses the requirements specification to plan the program. When design is finished, the programmer knows every task, how each task is done and how the tasks work together. It is written down as structure diagrams, flowcharts and pseudocode (Lessons 2–5).
4 · Coding and iterative testing
The program is written in a programming language, one module at a time. Each module is tested as soon as it is written. If it fails, the code is amended and the test is repeated. This loop is iterative testing.
5 · Testing
The finished program is run many times with different sets of test data. This proves that all the modules work together as the design specified. Lesson 9 shows how to choose that data.
Worked Example 12 min
Worked example 1 · A library fine calculator through all four stages
A school library charges $0.50 for each day a book is late. The fine never goes above $10. The librarian wants a program to work it out.
- Analysis — write the requirements. Input: number of days late. Output: the fine. Rule: 50 cents a day, capped at $10.everyone must agree what the program does before anyone plans or codes it.
- Analysis — abstraction. Keep: days late, daily rate, the cap. Discard: book title, cover colour, the borrower's class.those details do not change the fine, so they only add clutter.
- Analysis — decomposition. (a) get the days late, (b) calculate the fine, (c) apply the $10 cap, (d) output the fine.four small tasks are easier to design, code and test than one big one.
- Design — pseudocode. Each sub-task becomes one or more statements:
// Design: work out the fine for a late book DECLARE DaysLate : INTEGER DECLARE Fine : REAL INPUT DaysLate Fine ← DaysLate * 0.5 IF Fine > 10 THEN Fine ← 10 ENDIF OUTPUT "Fine: $", Finethe design is language-free, so any programmer can code it. - Coding — first attempt, then iterative testing. The programmer's first version forgot the cap. Testing the module with 30 days late gives 15.0, but $10 was expected. The code is amended and the test is repeated:
# Coding: the amended module (cap added after a failed test) days_late = int(input("Days late: ")) fine = days_late * 0.5 if fine > 10: fine = 10 print("Fine: $", fine)
Days late: 30 Fine: $ 10
a failed module test → amend → re-test is exactly what iterative testing means. - Testing — the whole program. Run it with several sets of data and compare with the expected results:
20 days is exactly where the cap starts, so it is the value most likely to expose a fault.Days late Expected fine Actual Pass? 0 0 0.0 ✔ 3 1.5 1.5 ✔ 20 10 10.0 ✔ 30 10 10 ✔
Worked example 2 · Abstraction for a step-counter app
A fitness company wants an app that tells a user whether they reached 8000 steps today. Sort the details.
- List everything you could know. Steps today, the goal of 8000, the user's shoe size, weather, phone colour, date, the user's favourite song.
- Ask of each item: does the answer depend on it?abstraction is judged against the problem; weather matters for a running app, not here.
Keep (key elements)
- steps today
- the goal (8000)
- the date (to reset each day)
Discard (unnecessary)
- shoe size
- weather
- phone colour, favourite song
- Write it as an exam answer. "Abstraction keeps the steps, goal and date, which decide the result, and discards details such as shoe size that do not affect it."a good answer names the rule and applies it to the scenario.
Try It Yourself 12 min
Goal: Put these in PDLC order and name the stage of each: (a) a flowchart is drawn; (b) the whole app is run with many sets of data; (c) users are interviewed about what they need; (d) a module is written, tested and fixed.
Goal: A school wants a bus-timetable app that shows the next bus to school. List three details to keep and three to discard, and give a reason for one of each.
Goal: A team is making a quiz game with a scoring module and a timer module. Explain how iterative testing and final testing would each be used, and why both are needed.
Hint
Iterative testing checks one module on its own, again and again. Final testing checks the scoring and timer together — what if the timer ends mid-answer?
📝 Exam Practice 10 min
State the four stages of the program development life cycle, in order.
Mark scheme
- Analysis (1)
- Design (1)
- Coding (1)
- Testing (1)
- All four must be in this order for full marks.
Describe what is meant by abstraction.
Mark scheme
- Keeping the key elements / information needed to solve the problem (1).
- Discarding / removing unnecessary details (1).
A cinema wants an online ticket-booking program. Explain how the analysis and design stages would be used when developing it.
Mark scheme
- Analysis: find out / define what the cinema requires, e.g. seats, prices, showings (1).
- …producing a requirements specification (1).
- …using abstraction / decomposition, e.g. splitting booking, payment and printing tickets (1).
- Design: plan how the program will work / how the tasks fit together (1).
- …using structure diagrams / flowcharts / pseudocode (1).
- Max 4; at least one mark from each stage.
Complete the table by writing the stage of the program development life cycle in which each task happens.
| Task | Stage |
|---|---|
| Pseudocode is written for the payment routine | …… |
| A module is run, fixed and run again until it works | …… |
| The problem is broken down into smaller parts | …… |
Mark scheme
- Design (1)
- Coding (iterative testing) (1)
- Analysis (1)
🗝️ Recap & Key Terms 3 min
Every program goes through analysis → design → coding → testing. Analysis defines the problem with abstraction and decomposition. Design plans the solution. Coding builds and iteratively tests each module. Testing checks that the whole program works.
- Analysis
- Investigating the problem, leading to a specification of what the program is required to do.
- Design
- Using the specification to show how the program will be developed (structure diagrams, flowcharts, pseudocode).
- Coding
- Writing the program or suite of programs.
- Testing
- Systematic checks on a program to make sure it works under all conditions.
- Abstraction
- Keeping the key elements needed for the solution and discarding unnecessary details.
- Decomposition
- Breaking a complex problem into smaller parts that can each be solved more easily.
- Iterative testing
- Testing a module, amending the code and repeating the tests until the module works as required.
Homework 1 min
Task (≤ 15 min): A café wants a program that takes customers' orders and totals the bill. Describe what would happen at each of the four stages of the program development life cycle. [8]
Model answer
- Analysis: find out what the café needs — menu items, prices, how bills are paid (1); write a requirements specification using abstraction and decomposition, e.g. take order / total / print receipt (1).
- Design: plan how the program works (1) with a structure diagram, flowcharts or pseudocode for each part (1).
- Coding: write each module in a programming language (1) and test each one iteratively, amending until it works (1).
- Testing: run the complete program (1) with several sets of test data to check all parts work together, e.g. an order of 0 items or 100 items (1).