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 1.4 (1 of 2): Functional requirements and secure by design

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.

50 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

Buy the lock after the robbery?

A shop is robbed. The owner then buys a lock. That is too late.

A wise owner plans the lock when the door is made.

Software works the same way. You plan safety from the start. In this lesson you say exactly what the software must do, with safety planned in.

Key words

WordWhat it meansExample
Functional requirementSomething the software must do.The user can pay by card.
Non-functional requirementHow well the software must work, not what it does.It loads in 3 seconds.
Secure by designPlanning safety in from the very start.check every input from the start
InputData that goes into the software.a name typed in a box
ProcessingWhat the software does with the data.add up the prices
LogicThe rules and decisions the software follows.if the total is 50 or more, delivery is free
PlatformThe device or system the software runs on.Android phone, web browser
RequirementSomething the software must do or be.pay by card

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

Check: what it does or how well

Have a go

Check: what it does or how well

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

Five parts of a functional requirement

PartThe questionCinema ticket app
InputsWhat goes in?Number of adults and children, a date, an email address
Data neededWhat facts must be stored or looked up?Ticket prices, film times, booking numbers
ProcessingWhat is done with the data?Add up the cost, check there are enough free seats
LogicWhat rules and decisions apply?Groups of 10 or more get a discount
PlatformsWhere is it used and run?On phones and in a web browser; runs on a cloud server

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

Which of the five parts is it?

Have a go

Loading…

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

Requirements become lines of code

Code: python
adults = 2
children = 3

# Input: adults and children
# Data needed: the two prices
adult_price = 8
child_price = 5

# Processing: add up the cost
total = adults * adult_price + children * child_price

# Logic: a group of 10 or more gets 10 pounds off
if adults + children >= 10:
    total = total - 10

print(total)

# Change adults to 6 and children to 6, then run it again.

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

Secure by design

Secure by design means you ask "what could go wrong?" while you write the requirements. You do not wait for a hacker.

It changes the requirements you write. You decide who may see what. You decide that every input is checked. You decide to store only the data you really need.

Security thinking turns into requirements

Question while planningRequirement that follows
What if somebody types something harmful?Every input is checked before it is used.
Who should see a customer's details?Only the customer and named staff can see them.
What if the password is guessed?After 5 wrong tries, the account is locked for 10 minutes.
Do we need the date of birth?No. Do not collect data we do not need.
What if the data is stolen?Passwords and card details are never stored as plain text (text that anybody can read).

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

Turn three requirements into code

Write the function for the cinema ticket app. Follow the three requirements in the comments. R1: the two prices. R2: the group discount. R3: bad input gives back None. Press Run Tests when you are ready.

Code: python
def ticket_total(adults, children):
    # Requirements for a cinema ticket:
    # R1. An adult ticket costs 8 pounds. A child ticket costs 5 pounds.
    # R2. A group of 10 people or more gets 10 pounds off the total.
    # R3. Bad input: if adults or children is below 0, give back None.
    return 0

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

A good requirement is clear and testable

Tip

Bad: "The app should handle a group."

Good: "A group of 10 or more gets 10 pounds off the total."

A tester can check the second one. Nobody can check the first.

Write the requirements for a trip app

A school wants an app for booking a school trip. Parents choose a trip, say how many children go, and pay.

Write the functional requirements. Use these five headings.

  1. Inputs (at least three):
  2. Data needed (at least two):
  3. Processing (at least two):
  4. Logic (at least two rules):
  5. Platforms:

Then write two requirements that come from secure by design thinking.

Example for Logic: "If a trip is full, the parent sees a message and cannot book."

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.

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

Final check

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

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.