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

Free lesson

OS 4.1 (6 of 6): Choosing a design approach

The whole lesson, free. Read it and have a go at the activities. To work the tasks and labs in the real lesson, press Start lab, with no account needed.

40 minutes

A quick check that you are not a bot, then your own lab opens on the interactive lesson.

Already have an account? Sign in

Four problems, one choice

Problem 1: a pizza app with many steps. Problem 2: a game with 100 zombies. Problem 3: a library that must remember who has which book. Problem 4: a payment rule that must never be wrong.

Does one design method fit all four? No. A good developer thinks first, then chooses. This is called critical thinking.

Key words

WordWhat it means
FunctionA small named job in a program.
Unit testA test that checks one small part of the code.
Design approachA way of planning software before and while you build it.
Critical thinkingAsking questions, comparing choices and giving reasons for your decision.
Top-down designSplitting the whole system into smaller and smaller jobs.
Object-oriented designBuilding the program from objects (things that hold data and can act). A class is the plan for making an object.
Data modelA picture of the data you need and how it is organised.
TDDTest-driven development. Write a failing test first, then the code.
BDDBehaviour-driven development. Write the wanted behaviour in plain words first.
Functional designBuilding a program by joining small functions that take values in and give values back, often passing functions to other functions.
Project methodThe plan for how a team runs a whole project.
WaterfallA project method with steps one after another: plan, design, build, test.
AgileA project method that works in short steps and welcomes change.
SprintA short, fixed time, often two weeks, in which an agile team finishes some work.

The cells students fill in are left blank in this preview.

Six approaches at a glance

ApproachIt starts fromGood forExample
Top-down (function-orientated)The whole system, split into jobsA system with many steps and data that movesA pizza ordering system
Object-orientedThe things in the problemMany similar things that share behaviourA game with many characters
Data modelThe data and how it linksSystems that store a lot of linked dataA school library
TDDA failing unit testRules that must be exactly rightA fare calculator
BDDA behaviour in plain wordsWork with customers who are not developersA student ticket feature
FunctionalSmall functionsJobs that change data step by stepSorting and filtering a list

The cells students fill in are left blank in this preview.

Match the problem to the approach

Have a go

Loading…

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

Approaches work together

The approaches do not compete. One project often uses several.

A game team may plan the whole game top-down. They use classes for the characters. They draw a data model for scores and players. They write tests first for the scoring rules.

You choose by asking questions about the problem.

Questions that help you choose

flowchart TD
  start([A new problem]) --> q1{Is there a lot of linked data to store?}
  q1 -->|yes| dm[Draw a data model]
  q1 -->|no| q2{Are there many similar things?}
  dm --> q2
  q2 -->|yes| oop[Use object-oriented design]
  q2 -->|no| td[Split the system top-down]
  oop --> q3{Must a rule be exactly right?}
  td --> q3
  q3 -->|yes| tdd[Write tests first: TDD]
  q3 -->|no| bdd[Describe the behaviour first: BDD]

Three approaches in one program

Code: python
# A data model: a dictionary of prices
MENU = {"pizza": 8, "chips": 3}


# Function-orientated design: one small job
def total(items):
    cost = 0
    for item in items:
        cost = cost + MENU[item]
    return cost


# Object-oriented design: a class
class Order:
    def __init__(self, items):
        self.items = items

    def cost(self):
        return total(self.items)


# Test-driven: the test says what we want
def test_cost():
    assert Order(["pizza", "chips"]).cost() == 11


test_cost()
print("The test passes")

Make a free account to save your work and track your progress.

Which approach fits?

Have a go

Which approach fits?

5 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

Design inside a project method

Every team also has a project method. It decides when design happens.

In waterfall, you design once, before you build. A wrong choice costs a lot later.

In agile, you design a little in every sprint. TDD and BDD fit well, because tests and behaviours are small and can change.

Waterfall and agile: when do you design?

WaterfallAgile
Design happensOnce, near the startA little in every sprint
If the customer changes their mindHard and expensiveNormal. Change the next sprint
Approach that fits wellTop-down design and a full data modelTDD, BDD and small steps of any approach
RiskA mistake in the design is found lateNo overall plan if nobody keeps one

The cells students fill in are left blank in this preview.

Sort the problems by approach

Have a go

Loading…

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

Choose the approaches for a project

A sports club wants an app. Players see match times. Parents book places and pay. The coach adds results. The club has four students who will build it in six weeks, in three sprints. Choose three design approaches for this project. For each one, say which part of the app it helps with and why. Then say whether you would use waterfall or agile, and give one reason.

A teacher marks this in a college. Nothing you write here is kept: it goes when you leave the page.

Make a free account to save your work, or press Start lab to work through the whole lesson.

Exit quiz

Have a go

Exit quiz

6 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

Teach this lesson with your class

On a college account your students work the tasks and the labs as well, and every mark is kept for you.