Lunch for 30 people
You must make lunch for 30 people by 12 o'clock. It feels too big.
So you split it: make a shopping list, buy food, cook, serve, clean up. Each job is small. Each job has one owner.
Developers do the same with a big brief.
Key words
| Word | What it means | Example |
|---|---|---|
| Decomposition | Splitting a big problem into small parts. | booking tool: book, cancel, price |
| Subtask | A small job inside a bigger job. | check the hour |
| User story | One need, told from the user's side. | As desk staff, I want to see the day's bookings |
| Function | A named piece of code that does one job. | cancel() |
| Abstraction | Leaving out details you do not need. | a booking is a name, court and hour |
| Refinement | Adding more detail to a part, one level at a time. | check the hour: 9 to 20 only |
| Dependency | A job that must finish before another starts. | design before build |
The cells students fill in are left blank in this preview.
The Hillside tool, split into parts
flowchart TD
tool([Booking tool])
tool --> book[Make a booking]
tool --> cancel[Cancel a booking]
tool --> show[Show a day]
tool --> price[Work out the price]
book --> hours[Check the hour]
book --> free[Check the court is free]
book --> save[Save the booking]
Match the job to the part
Have a go
Loading…
Your answers are marked here and are not kept. A college account keeps every student’s marks.
A good piece does one thing
A good piece is small enough to do in one sitting. It does one thing. You can test it alone.
Ask: "Can I say what this piece does in one short sentence?" If you cannot, split it again.
Refinement adds detail in rounds
Do not write every detail at once. Work in rounds. This is refinement.
Round 1: "Make a booking." Round 2: "Check the hour, check the court, save." Round 3: "The hour must be from 9 to 20."
Each round adds detail and hides nothing. Write one line on why you split the problem that way. A marker rewards a reason for the split, not only the split.
Try it: each part is a function
def check_hour(hour):
return hour >= 9 and hour <= 20
def price_for(is_member, hours):
if is_member:
rate = 4
else:
rate = 6
return rate * hours
print(check_hour(10))
print(check_hour(21))
print(price_for(True, 2))
# Call price_for for a visitor for 3 hours.
Make a free account to save your work and track your progress.
User stories: needs from the user's side
A user story is one sentence. It has three parts: who, what, why.
"As a desk worker, I want to see all of Saturday's bookings, so that I can tell a caller which hours are free."
One story is one need. Stories are easy to test.
Check: split a problem
Have a go
Check: split a problem
5 questionsStage 1: split the brief
This is stage 1 of the Hillside practice project. Finish the diagram. Add the missing parts of the tool. Then split Make a booking into at least three smaller jobs. After the diagram, write three user stories (who, what, why) in a short list.
flowchart TD
tool([Booking tool])
tool --> book[Make a booking]
tool --> cancel[Cancel a booking]
%% Add more parts below: show a day, work out the price, count a member's bookings.
%% Then split "Make a booking" into at least three smaller jobs.
Make a free account to save your work, or press Start lab to work through the whole lesson.
Order matters
Tip
Some jobs cannot start until another one finishes. You cannot test a function that does not exist. Mark these links. They decide the order of your plan in the next lesson.
Key words crossword
Have a go
Loading…
Your answers are marked here and are not kept. A college account keeps every student’s marks.
Final check
Have a go