English:Decomposition, abstraction and algorithm design - Computing Year 10
Introduction
Turn a vague request into a precise, testable algorithm. Decompose an invented parking tariff, select the relevant information, then transfer the method to parcel pricing. Follow worked traces, a complete decision-flow specification and executable code; compare normal, boundary and invalid cases before judging success.
Specify decompose and abstract a pricing problem
Turn a request into a precise specification
“Make a price calculator” is too vague to test. Ask who needs the result, which inputs exist, what each input means, the rules and the required output. A useful specification states units, valid ranges, boundary behaviour and error handling. Requirements are what the solution must achieve; an implementation is one way of achieving them. Agree ambiguous rules before writing code instead of guessing from the first attractive interface.
For an entirely fictional car park, use these rules: arrival and departure are integer minutes after midnight from 0 through 1439 on the same day. Departure must not precede arrival. The first 15 minutes are free. Only the time beyond those 15 minutes is charged: each started block of 60 further minutes costs 250 pence, with a 1000-pence maximum for this one stay. No overnight stay, real parking payment, discount or enforcement rule is included.
Vehicle colour is irrelevant to this tariff and can be omitted. Duration, the 15-minute allowance, started-hour rule and price cap are relevant and must remain. That is abstraction: selecting the features needed for the purpose, not making the problem vague or pretending every real car park uses these rules. If a later specification used a resident permit or vehicle category, the relevant inputs could change.
Decompose the parking calculator
| Subtask | Input or responsibility | Result or contract |
|---|---|---|
| Validate | Check integer time types, same-day ranges and time order | Accept a valid pair or return a clear error |
| Calculate duration | Subtract arrival from departure | Non-negative integer minutes |
| Apply tariff | Remove the free allowance, round started blocks upward and cap the charge | Integer fee in pence |
| Present | Label the fee and explain the fictional assumptions | Readable result without claiming real payment |
For arrival 540 and departure 616, the clock times are 09:00 and 10:16. Duration is 616 − 540 = 76 minutes. Removing the 15-minute allowance leaves 61 chargeable minutes. One 60-minute block is insufficient, so two started blocks cost 2 × 250 = 500 pence, or £5.00. The cap does not change this result. Keep the intermediate values in a trace rather than writing only a final answer.
Make boundary rules visible
At 15 minutes the fee is zero; at 16 it becomes 250 pence. At 75 minutes, exactly 60 chargeable minutes cost 250; at 76, 61 chargeable minutes cost 500. At 195 minutes the fee is 750; at 196 it reaches the 1000-pence cap. These tests distinguish “charge after the allowance” from charging every hour of the whole stay. The latter would implement a different tariff.
Money is stored here as integer pence so that a rule like 5000 means exactly £50.00 in the declared currency. Time input is already converted into minutes for this teaching model. Parsing a typed time, converting currencies and integrating a payment provider would be separate requirements with separate validation. This course performs none of those real services.
Identify sequence, selection and iteration
Sequence gives an order: validate before calculate before present. Selection chooses a branch such as valid/invalid or a price band. Iteration repeats a defined task, for example running the calculator for each synthetic test case. A single fee calculation does not need a loop merely to show that you know the word iteration. Choose constructs for the problem; unnecessary repetition can make a correct specification harder to follow.
Represent a complete parcel algorithm and its decisions
Transfer the method to parcel pricing
The required transfer is another invented calculator. Inputs are parcel weight in integer grams from 1 through 20,000 and the goods value before delivery in integer pence from 0 through 1,000,000. Currency is GBP. Validate both inputs before applying a free-delivery rule. A zero-weight parcel, a missing value, a string, a Boolean or a value outside the contract is rejected even if the order would otherwise qualify for free delivery.
Goods worth at least 5000 pence qualify for free delivery. Below that threshold, weight 1–1000 g costs 300 pence, 1001–5000 g costs 500 pence and 5001–20,000 g costs 900 pence. Output both the delivery charge and goods value plus delivery. The threshold uses goods value before delivery; adding a delivery fee must not retrospectively turn the same order into a free-delivery order.
For 1200 g and goods worth 4599 pence, the goods value is below 5000 and the parcel falls in the middle band. Delivery is 500 pence and the total is 4599 + 500 = 5099 pence, or £50.99. The total exceeding £50 does not make delivery free under the stated pre-delivery threshold. For the same valid parcel with goods worth exactly 5000 pence, delivery is zero and the total stays 5000.
Write unambiguous pseudocode
Pseudocode expresses the algorithm without requiring a particular programming language. Define its terms: AT LEAST includes equality; AT MOST includes equality; the declared ranges are inclusive; STOP ends this call. This pseudocode is a readable specification, not a claim that a Python interpreter can execute these English words.
INPUT weight_g, goods_pence
IF either input is not an integer OR outside its declared range THEN
OUTPUT an input error
STOP
END IF
IF goods_pence IS AT LEAST 5000 THEN
delivery_pence = 0
ELSE IF weight_g IS AT MOST 1000 THEN
delivery_pence = 300
ELSE IF weight_g IS AT MOST 5000 THEN
delivery_pence = 500
ELSE
delivery_pence = 900
END IF
total_pence = goods_pence + delivery_pence
OUTPUT delivery_pence, total_pence
STOPEach valid weight reaches exactly one price result, and both valid and invalid paths terminate. The free threshold is tested after validation and before weight pricing. A collection of independent IF statements could accidentally overwrite an earlier result if their conditions overlap; the mutually exclusive ELSE IF chain makes the intended choice explicit.
Construct the complete decision flowchart
Use a rounded terminator for start/end, a parallelogram for input/output, a rectangle for processing and a diamond for a yes/no decision. Arrows carry control; give each decision two labelled exits. The following original connection table specifies every node and arrow for the parcel flowchart. Draw it on paper or in an approved diagramming tool. For a non-decision row, both final columns name the same single next node.
| Node | Shape | Operation or question | Yes or ordinary next | No |
|---|---|---|---|---|
| S | Start terminator | Start | I | I |
| I | Input parallelogram | Read integer grams and goods pence | V | V |
| V | Decision diamond | Inputs have correct types and declared ranges? | T | E |
| E | Output parallelogram | Output input error | X | X |
| T | Decision diamond | Goods value at least 5000 pence? | F | W1 |
| F | Process rectangle | Set delivery to 0 | O | O |
| W1 | Decision diamond | Weight at most 1000 g? | P1 | W2 |
| P1 | Process rectangle | Set delivery to 300 pence | O | O |
| W2 | Decision diamond | Weight at most 5000 g? | P2 | P3 |
| P2 | Process rectangle | Set delivery to 500 pence | O | O |
| P3 | Process rectangle | Set delivery to 900 pence | O | O |
| O | Output parallelogram | Output delivery and goods plus delivery in pence | X | X |
| X | End terminator | End | - | - |
For a worked trace, follow S → I → V → T → W1 → W2 → P2 → O → X for the 1200 g, 4599 pence input. A valid 5000-pence goods value goes from T to F and then O. Invalid input goes from V to E and X, never to a price result. Check that no arrow relies on an unstated jump or accidentally loops back into billing.

The Commons example uses a different task to illustrate visual conventions. Do not copy its temperature formula into the price calculator. Representations are useful when the reader can follow the intended steps, branches and end conditions. A beautifully drawn chart with the wrong equality boundary is still an incorrect solution.
TED-Ed: What’s an algorithm? by David J. Malan. Identify precise steps and a choice in the explanation, then relate them to our validation and price-band decisions. This is conceptual support, not an execution test of our code. Original: TED-Ed, What's an algorithm? - David J. Malan. The written explanations and native tasks work without sound or the external player.
Implement test and evaluate the design
Implement both original specifications
The following complete Python 3 program uses only local arithmetic and supplied values. It does not call a payment service, read a device, collect personal information or change files. Each function states an interface: named inputs, validation, a return value and a raised input error. The examples at the end print a parking fee of 500 and a parcel result containing delivery_pence 500 and total_pence 5099.
def parking_fee_pence(arrival, departure):
if type(arrival) is not int or type(departure) is not int:
raise ValueError("Times must be integer minutes")
if arrival not in range(1440) or departure not in range(1440):
raise ValueError("Use minutes 0 through 1439 in the same day")
if arrival > departure:
raise ValueError("Departure cannot precede arrival")
duration = departure - arrival
chargeable = max(0, duration - 15)
started_hours = (chargeable + 59) // 60
return min(1000, started_hours * 250)
def parcel_total_pence(weight_g, goods_pence):
if type(weight_g) is not int or type(goods_pence) is not int:
raise ValueError("Use integer grams and integer pence")
if weight_g not in range(1, 20001) or goods_pence not in range(1000001):
raise ValueError("Weight 1 to 20000 g; goods value 0 to 1000000 pence")
if goods_pence >= 5000:
delivery = 0
elif weight_g <= 1000:
delivery = 300
elif weight_g <= 5000:
delivery = 500
else:
delivery = 900
return {"delivery_pence": delivery, "total_pence": goods_pence + delivery}
print(parking_fee_pence(540, 616))
print(parcel_total_pence(1200, 4599))For non-negative whole chargeable minutes, adding 59 before integer division by 60 counts a partially started block. Zero chargeable minutes stays zero; 60 stays one block; 61 becomes two. max prevents the free allowance from producing negative chargeable time, and min applies the declared price cap. Neither operation grants permission to change an input specification or ignore invalid times.
Test against the specification rather than appearances
| Case | Expected result | What it checks |
|---|---|---|
| Parking duration 0, 15, 16 | 0, 0, 250 pence | Zero and the inclusive allowance boundary |
| Parking duration 75, 76 | 250, 500 pence | Exactly one chargeable hour versus a started second |
| Parking duration 195, 196 | 750, 1000 pence | Cap transition |
| Parcel weights 1000, 1001 below threshold | 300, 500 pence delivery | First weight-band equality |
| Parcel weights 5000, 5001 below threshold | 500, 900 pence delivery | Second weight-band equality |
| Goods values 4999, 5000 with weight 1200 | 500, 0 pence delivery | Inclusive free-delivery threshold |
| Invalid weight 20001 with goods value 5000 | Input error rather than free delivery | Validation before the attractive shortcut |
Record the exact input, expected result, actual result and pass/fail. Use missing values, wrong types, out-of-range inputs and reversed times as invalid cases. An input can be valid for one subtask and invalid for another; validate the complete declared contract. A screenshot of the worked result does not prove that the boundary or error paths ran.
Use feedback to revise the right layer
Suppose a first design charged the whole duration in hourly blocks, so 75 minutes produced 500 rather than the specified 250. The trace reveals that the free allowance was applied incorrectly. Correct that rule in the design and implementation, retain the original failed test, then rerun the allowance, started-hour and cap cases. Do not alter the expected answer merely to make an incorrect program pass.
Suppose a second design returned free delivery before checking weight. It would accept an invalid 20,001 g parcel at the threshold. Move complete validation before the selection. This is a different defect from formatting the output in pounds. Decomposition helps isolate whether a problem lies in input policy, calculation, control flow or presentation.
Evaluate an abstraction and its limits
The parking model omits overnight stays and time parsing because they are outside its same-day contract. The parcel model omits dimensions, destinations and surcharges because this invented tariff does not use them. Do not claim that these omissions are appropriate for a real commercial service without reviewing its actual requirements. Removing an important input is a modelling error, not successful abstraction.
To extend either program, state the changed requirement and revise affected interfaces, pseudocode, flowchart and tests together. For example a discount might apply before or after a cap: those orders can yield different answers. Ask which is required instead of assuming. Keep synthetic cases and give outputs useful labels; no actual billing or learner data is required.
Submit a defensible design portfolio
Provide requirements, relevant/omitted features with reasons, an input-process-output decomposition, the complete pseudocode or a fully connected flowchart, normal/boundary/invalid traces and any actual program execution record. Explain one revision with its original evidence and retest. State what remains unimplemented or untested. Alternative correct designs are welcome if their control flow and evidence satisfy the same contract.
This Year 10 allocation prepares GCSE-style systematic problem solving within the mapped England KS4/common subject-content pathway. It is not a claim that every awarding organisation uses identical pseudocode notation or that this page completes a qualification. Check the school’s chosen specification and approved programming environment. Practical competence requires the learner’s own reproducible work and appropriate teacher verification, not just reading an executed example.
Interactive Tasks
Quiz: Test Your Knowledge
Which statement best describes abstraction here? (Retain duration and tariff rules while omitting irrelevant vehicle colour) (!Remove the rules until the problem becomes vague) (!Ignore the free allowance because it is inconvenient) (!Assume the model fits every real car park)
What is the first responsibility in the parking decomposition? (Validate the declared input types ranges and time order) (!Charge a card before reading a specification) (!Draw a decorative chart and skip the inputs) (!Replace a missing time with zero silently)
What is the fee for the worked 76-minute stay? (500 pence) (!250 pence) (!750 pence) (!Zero pence)
What is the fee at exactly 75 minutes under this invented tariff? (250 pence) (!500 pence) (!750 pence) (!1000 pence)
What is the parcel total for 1200 g and goods worth 4599 pence? (5099 pence) (!4599 pence) (!500 pence) (!5499 pence)
Which value determines free-delivery eligibility? (The valid goods value before delivery is added) (!The final total after adding delivery) (!The parcel colour) (!Any invalid order value because free is attractive)
What happens for weight 20001 g with goods worth 5000 pence? (Input error because validation precedes the free rule) (!Free delivery without a range check) (!A valid zero-weight parcel is invented) (!The weight is silently changed to 20000)
What does a decision diamond require in this flowchart? (Clearly labelled yes and no exits) (!Only a decorative arrow with no destination) (!A real payment provider) (!An unexplained infinite loop)
Which test pair checks the first parcel weight-band boundary below the free threshold? (1000 g and 1001 g) (!Two copies of 1200 g only) (!Vehicle colours red and blue) (!Goods values with no stated units)
What is an appropriate portfolio claim? (The recorded traces and actual tests support the declared limited model) (!One screenshot proves every possible real billing system correct) (!A flowchart eliminates the need for testing) (!The code performs a real authorised payment)
Memory Game
| Decomposition | Splitting the problem into responsibilities with clear interfaces |
| Abstraction | Selecting relevant features for the stated purpose |
| Specification | Precise requirements against which results are judged |
| Selection | Choosing one branch according to a condition |
| Iteration | Repeating a defined step or group of steps |
| Trace | Recording intermediate states for a stated input |
Drag and Drop
| Input policy | Define units valid ranges types and missing-value handling |
| Parking calculation | Remove the allowance then count started blocks and apply the cap |
| Parcel threshold | Compare the valid goods value before delivery with 5000 pence |
| Flowchart control | Follow labelled arrows through every branch to an end |
| Evidence and revision | Keep the failed result correct the relevant layer and retest |
Crossword Puzzle
| ABSTRACTION | What selects relevant features without making a model vague? |
| INTERFACE | What specifies how a subtask receives inputs and returns results? |
| SELECTION | What chooses an algorithm branch? |
| ITERATION | What repeats a task? |
| BOUNDARY | What kind of value lies at or beside a range limit? |
| PSEUDOCODE | What represents algorithm steps without a fixed executable-language syntax? |
LearningApps
Optional extra practice. Choose an appropriate activity with your teacher. If the external collection is unavailable, use the native activities and independent tasks in this course.
Cloze Text
Open Tasks
Easy
- List relevant inputs: State the parking times and tariff rules, then justify omitting vehicle colour.
- Trace the worked fee: Record duration, chargeable time, started hours and capped pence for 540 to 616.
- Explain the boundaries: Compare parking durations 15/16 and 75/76 using the actual rules.
- Identify control constructs: Give a meaningful sequence, selection and test-loop iteration example.
Standard
- Complete the required parcel design: State units, ranges, threshold, weight bands, outputs and an explicit assumption.
- Draw the complete flowchart: Use the connection table, label decisions and verify the normal and invalid routes.
- Test the implementation: Run approved code with normal, boundary and invalid data and keep actual results.
- Explain the threshold trap: Show why goods 4599 plus delivery 500 does not qualify retrospectively for free delivery.
Advanced
- Revise a faulty parking rule: Retain the failed 75-minute trace, correct the allowance logic and rerun affected boundary tests.
- Audit validation order: Show the invalid 20001 g free-threshold counterexample and repair the design before pricing.
- Evaluate a changed requirement: Add a hypothetical discount or overnight rule only after defining its order and assumptions.
- Defend a design portfolio: Compare representations, interface clarity, test evidence and model limitations without claiming real commercial approval.
Learning Check
- Parking decomposition and trace: Explain the worked fee using relevant inputs and subtasks.
- Parcel transfer and threshold: Price 1200 g with goods 4599 pence, then goods 5000 pence.
- Boundary and invalid tests: Explain exact limits and validation order.
- Pseudocode and flowchart equivalence: Trace the original flowchart and distinguish representation from execution.
- Revision and retesting: Correct a first attempt that charges 500 pence for 75 minutes.
- Evidence and scope: Describe an honest final portfolio.
Worked checks and assessment guidance
- Validate integer same-day minutes, calculate 616−540=76, remove 15 to get 61 chargeable minutes, count two started 60-minute blocks and return 500 pence after the 1000 pence cap. Omit vehicle colour under this tariff. Input validation, duration, tariff and presentation are distinct responsibilities.
- Below the threshold, the middle weight band gives 500 pence delivery and 4599+500=5099 pence total. Eligibility uses goods before delivery, so that total does not trigger free delivery. At valid goods value 5000, the delivery is 0 and total 5000. State GBP, integer grams/pence and the declared ranges.
- Parking 15/16 minutes gives 0/250 pence;75/76 gives 250/500. Below the parcel threshold,1000/1001 g gives 300/500 pence and 5000/5001 g gives 500/900. Invalid 20001 g is rejected even at a 5000 pence order. Missing or wrongly typed values are not silently replaced.
- For 1200 g and 4599 pence the route is S, I, V, T, W 1, W 2, P 2, O, X. Both representations validate first, choose the free threshold or exactly one weight band, and produce delivery plus total. The Commons temperature diagram illustrates conventions rather than parcel logic. Pseudocode and diagrams do not prove that a program ran.
- The stated tariff charges only time beyond 15 minutes. At 75 minutes,60 are chargeable, so one 250 pence block is correct. Preserve the failed trace, correct the allowance step and retest 15,16,75,76 and cap boundaries. Do not change the expected answer merely to match the defect.
- Provide a precise contract, justified abstraction, decomposition, connected algorithm representation, normal/boundary/invalid traces and actual execution records where performed. Explain one revision and a remaining limitation. These invented models exclude real payment services, overnight rules and many commercial constraints;reading the page does not establish a qualification or real-system approval.
Learning evidence
Keep the requirements, explicit assumptions, relevant/omitted features, subtask interfaces, complete pseudocode or connected flowchart, intermediate traces, actual normal/boundary/invalid test records and a justified revision. Mark paper predictions separately from executed code. No real payment, parking enforcement, private customer data or practical qualification is established by this course.
OER and Wikipedia
Department for Education: GCSE Computer Science subject content, updated 31 March 2025, systematic problem solving and abstraction/modular interfaces; DfE: Computing KS 4. Sources reviewed 14 November 2026. The Year 10 allocation is editorial within the school’s selected pathway; notation and assessment details depend on the awarding organisation. All tariffs, flows, examples, programs and questions are original invented teaching cases, not real parking or delivery prices.
Flowgorithm Input Process Output.svg, Dave Braunschweig, CC BY-SA 4.0. Unchanged original; caption and learning activities are original.
Linked learning areas
aiMOOC Projects
Schulfach+


aiMOOCs


aiMOOC Projekte


MOOCwiki · Deutsch
Nach dem Lernen ist vor dem Lernen
Entdecke direkt den nächsten Lernkurs. Weitere Inhalte erscheinen, wenn Du weiter nach unten scrollst.
Zur MOOCwiki-HauptseiteMediathek
Mediathek wird aus dem Wiki geladen ...
Keine passenden Inhalte gefunden. Bitte ändere Suche oder Filter.
NEWSLernweltNOAH fragen