Too big to build all at once
How do you build a whole shopping website? It is too big to build all at once.
But a shop has a few clear jobs. Show the products. Hold a basket. Take a payment. Send an email. You can build each job on its own.
Key words
| Word | What it means | Example |
|---|---|---|
| Decomposition | Breaking a big problem into smaller parts. | a shop: basket, payment, email |
| Feature | One thing the system must do or have. | search for a product |
| Block diagram | Boxes that show the parts of a system. | shop, basket, payment |
| Information flow diagram | A picture that shows what data moves between the parts. | order goes to the shop store room |
| Flowchart | A picture of steps, with arrows, in order. | start, check stock, end |
| Function | A named piece of code that does one job. | def item_cost |
The cells students fill in are left blank in this preview.
Warm up: break it down
Have a go
Warm up: break it down
3 questionsYour answers are marked here and are not kept. A college account keeps every student’s marks.
Why break a problem down?
A small part is easier to understand. It is easier to build, and easier to test.
A team can share the parts. One person does the basket. Another does the payment. You can also use a part again in another project.
There is a cost too. The parts must fit together later. Too many tiny parts are hard to look after.
The four tasks of decomposition
| Task | What you do | Cinema booking example |
|---|---|---|
| 1 Find the main features | List what the system must do. | Show films, pick seats, pay, send ticket |
| 2 Describe each feature | Say what goes in, what comes out, and what it does. | Pick seats: in = film and time. Out = chosen seats. |
| 3 Break the problem down | Split a feature that is still big. | Pay: check card, take money, show receipt |
| 4 Break the solution down | Split the plan or the code into small parts. | One function for each small job |
The cells students fill in are left blank in this preview.
Which task is it?
Have a go
Which task is it?
3 questionsYour answers are marked here and are not kept. A college account keeps every student’s marks.