Easier to read with cream paper, a tint, more contrast or larger text? Choose your colours and text, once, for every page.

Preview

Decomposition: break it down

This is the first page of the lesson. Read it and have a go at the activities. The rest is in the full lesson.

45 minutes

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

WordWhat it meansExample
DecompositionBreaking a big problem into smaller parts.a shop: basket, payment, email
FeatureOne thing the system must do or have.search for a product
Block diagramBoxes that show the parts of a system.shop, basket, payment
Information flow diagramA picture that shows what data moves between the parts.order goes to the shop store room
FlowchartA picture of steps, with arrows, in order.start, check stock, end
FunctionA 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 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Your 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

TaskWhat you doCinema booking example
1 Find the main featuresList what the system must do.Show films, pick seats, pay, send ticket
2 Describe each featureSay what goes in, what comes out, and what it does.Pick seats: in = film and time. Out = chosen seats.
3 Break the problem downSplit a feature that is still big.Pay: check card, take money, show receipt
4 Break the solution downSplit 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 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Your answers are marked here and are not kept. A college account keeps every student’s marks.

The lesson goes on

12 more parts of this lesson are in the full curriculum, with the tasks, the final check and the labs. A college account gives your students all of it.