OCR GCSE COMPUTER SCIENCE · J277 · PAPER 2
Computational thinking
Break it down, strip it back, plan the steps. How programmers tackle any problem.
Paper 2 · Lesson 15
Lesson by Computing
This lesson contains 18 slides, with interactive quizzes and text slides.
OCR GCSE COMPUTER SCIENCE · J277 · PAPER 2
Computational thinking
Break it down, strip it back, plan the steps. How programmers tackle any problem.
Paper 2 · Lesson 15
Lesson 15 of the J277 series and the first lesson of Block C (Paper 2, section 2.1.1 Computational thinking). Block C has a new emerald look so pupils can see they have moved on to Paper 2.
Device-free: show the slide; pupils write the title and date. Image credit: Ross Sneddon / Unsplash (cover hologram)
00 · MISSION · BY THE END OF THIS LESSON
By the end of this lesson you can…
01 Define decomposition, abstraction and algorithmic thinking.
02 Apply each one to a real problem.
03 Explain how they help a programmer solve a problem.
Read the three outcomes. These three principles underpin the whole of Paper 2: pupils will use them in every algorithm and program they write from now on. Exam questions often give a scenario and ask how decomposition or abstraction could be used.
Device-free: pupils copy the outcomes and tick each one at the end.
02 · CHECK · DO NOW (LESSON 14)
Warm up: impacts and the law
1 Name the three laws in the specification.
2 What makes software open source?
3 Give one environmental impact of technology.
4 What is the digital divide?
▮ TERMINAL // do_now_answers
1 DPA 2018, CMA 1990,
CDPA 1988
2 its source code is shared
and can be changed
3 e-waste, mining or energy
4 gap between people with
and without access
Retrieval from lesson 14, the last lesson of Block B. Give 4 minutes, then click to reveal the answers line by line.
1 The Data Protection Act 2018, the Computer Misuse Act 1990 and the Copyright, Designs and Patents Act 1988. 2 Its source code is made available, and users can change it and share it. 3 Any one: e-waste from thrown-away devices; mining metals for devices; energy used by data centres and charging. 4 The gap between people who have good access to technology and the internet, and people who do not.
Device-free: questions on the board; mini whiteboards.
Recap: Jo logs in to a classmate's account without permission. Which law is broken?
Data Protection Act 2018
Computer Misuse Act 1990
Copyright, Designs and Patents Act 1988
No law is broken
Answer: B, the Computer Misuse Act 1990. Logging in to someone else's account without permission is unauthorised access, the first of its three offences.
Device-free: students hold up A, B, C or D cards. Image credit: Aerps.com / Unsplash
01 · LEARN · MISSION BRIEFING
Think like a programmer
Computational thinking is solving a problem in a way a computer could carry out.
DECOMPOSITION
Break a big problem into smaller ones.
ABSTRACTION
Remove the detail that does not matter.
ALGORITHMIC THINKING
Work out the steps to a solution, in order.
SYSTEM VOICE
System online. Block C begins: welcome to Paper 2. Today you will learn to think like a programmer: break big problems into smaller ones, ignore the detail that does not matter, and plan the steps to a solution.
Click play for the system voice briefing. The words are also on the slide.
Computational thinking is a way of solving problems so that the solution could be carried out by a computer. J277 names three principles: decomposition, abstraction and algorithmic thinking. Programmers use them together, not one at a time.
Device-free: pupils write the three words and guess what each means before the next slides.
01 · LEARN · DECOMPOSITION
Break it down
DECOMPOSITION
Breaking a complex problem into smaller sub-problems that are easier to understand and solve.
+ each part can be solved on its own
+ different people can work on different parts
+ parts can be tested one at a time
▮ TERMINAL // school_trip
> plan school_trip
├─ choose a place
├─ book transport
├─ collect money
│ ├─ set the price
│ └─ track who paid
├─ permission slips
└─ plan the day
Decomposition: breaking a complex problem down into smaller, more manageable sub-problems. Each sub-problem can be solved separately, by different people, and tested on its own; together the solutions solve the whole problem. Sub-problems can be broken down again, as "collect money" is here.
Click the terminal to build the tree one line at a time. Ask: what else could "plan the day" be broken into?
Device-free: pupils decompose "organise a birthday party" into at least four sub-problems.
01 · LEARN · ABSTRACTION
Keep only what matters
THE TUBE MAP
It keeps the stations, the lines and their order. It leaves out real distances, streets and bends, because a passenger does not need them.
SYSTEM VOICE · KEY DEFINITION
Abstraction means removing unnecessary detail from a problem, so that you can focus on the parts that really matter.
Abstraction: removing unnecessary detail from a problem so that you can focus on the important parts. The London Tube map is the classic example: it is not to scale and ignores streets and real distances, but keeps what a passenger needs (stations, lines, connections and their order).
Play the key definition. Ask: what does a computer football game keep from real football, and what does it leave out? (Keeps players, ball, rules, score; leaves out weather details, crowd noise of individuals, the grass growing.)
Device-free: pupils list three things a school timetable app would keep and three things it would leave out. Image credit: Fulton Browne / Unsplash
01 · LEARN · ALGORITHMIC THINKING
Plan the steps, in order
ALGORITHMIC THINKING
Working out the steps needed to solve a problem, and the order they go in.
The result is an algorithm: a sequence of steps that solves a problem.
A good algorithm could be followed by anyone, or by a computer, and always gives the right answer.
▮ TERMINAL // find_highest
1 highest = first score
2 for each other score:
3 if score > highest:
4 highest = score
5 output highest
> scores 12, 31, 7, 25
31
Algorithmic thinking: identifying the steps needed to solve a problem and putting them in the right order. An algorithm is a sequence of steps that can be followed to complete a task or solve a problem.
Click the terminal to reveal the algorithm one line at a time, then trace it with the scores 12, 31, 7, 25: highest starts at 12, becomes 31, stays 31 for 7 and 25. Output: 31. Pupils will write algorithms like this in pseudocode and flowcharts next lesson.
Device-free: pupils trace the algorithm on paper with their own four numbers.
Which skill is being used? Drag each example.
DECOMPOSITION
ABSTRACTION
ALGORITHMIC
Write the exact steps to find the shortest queue
Split a game into menu, levels and scoring
A satnav shows roads but not buildings
A weather app shows a cloud icon, not the raw readings
Set out the order of steps for a vending machine
Plan a party as food, music and invites
Answers: decomposition = split a game into menu, levels and scoring; plan a party as food, music and invites. Abstraction = a satnav shows roads but not buildings; a weather app shows a cloud icon, not the raw readings. Algorithmic thinking = write the exact steps to find the shortest queue; set out the order of steps for a vending machine.
Device-free: pupils sort the six examples into three columns in their books.
Priya's satnav hides shops and houses and shows only roads. Which skill is this?
Decomposition
Algorithmic thinking
Validation
Abstraction
Answer: D, abstraction. The satnav removes detail the driver does not need (shops, houses) so the route is easy to follow. Validation is a distractor from a later lesson: checking that input data is sensible.
Device-free: students hold up A, B, C or D cards. Image credit: fruitfullmedia / Unsplash
01 · LEARN · ALL THREE TOGETHER
Worked example: a quiz app
1 · DECOMPOSE
Ask a question
Check the answer
Keep the score
Show the final score
2 · ABSTRACT
A question is just: the question text, four answers and which one is right.
Ignore fonts, colours and sounds for now.
3 · PLAN THE STEPS
score = 0
for each question: ask it
if the answer is right: score = score + 1
output score
Work through the example one column at a time (click to reveal each line). This is the order a programmer often follows: decompose the problem, use abstraction to decide what data each part really needs, then design the algorithm for each part.
Ask: what would you add to the decomposition if the quiz had a timer? (Start the timer, check the time left, stop the quiz when time runs out.)
Device-free: pupils copy the three columns and add one more sub-problem of their own.
03 · DEBUG · SPOT THE MISTAKE
One line in Kofi's notes is wrong
▮ TERMINAL // kofi_notes.txt
1 decomposition: split into sub-problems
2 sub-problems: can be solved separately
3 abstraction: add detail to be realistic
4 algorithm: a sequence of steps
5 algorithmic: plan steps in order
Line 3. Abstraction REMOVES unnecessary detail so you can focus on what matters. It does not add detail.
Check each line against the definitions you learned. Then tap the marker.
Tip: learn one clear sentence for each of the three principles.
Give a minute to find the mistake before tapping the marker.
Answer: line 3. Abstraction means removing unnecessary detail, not adding it. Lines 1, 2, 4 and 5 are correct.
Device-free: copy the five lines onto the board; pupils write the wrong line number and the correction.
The machine releases the snack and any change
The customer chooses a snack
The machine asks for payment
The machine checks enough money was paid
The machine checks the snack is in stock
Algorithmic thinking. Put the vending machine's steps in order.
Correct order: 1 the customer chooses a snack; 2 the machine checks it is in stock; 3 it asks for payment; 4 it checks enough money was paid; 5 it releases the snack and any change.
Ask: what should happen if the snack is out of stock, or not enough money is paid? (Show a message and let the customer choose again or add more money.) This leads into selection in a later lesson.
Device-free: pupils write the five steps on sticky notes and order them on the desk.
Complete the summary.
Breaking a problem into smaller parts is called decomposition. Each smaller part is a sub-problem, which can be solved on its own. Removing detail that is not needed is called abstraction. Working out the steps to a solution, in the right order, is algorithmic thinking, and the result is an algorithm.
Answers in order: decomposition, sub-problem, abstraction, algorithmic, algorithm. Distractors: encryption, compression, iteration.
Device-free: paragraph on the board with gaps and the word bank; pupils write the five missing words.
EXAM · A leisure centre wants a program to book swimming lessons. Describe how the programmer could use decomposition and abstraction. [4 marks]
Exam-style question, 4 marks. Give 5 minutes. The model answer is on the next slide.
Mark scheme: decomposition, up to 2 marks: 1 mark for saying it breaks the problem into smaller sub-problems; 1 mark for an example from this context (such as choosing a lesson, checking spaces, taking payment, sending a confirmation). Abstraction, up to 2 marks: 1 mark for saying it removes unnecessary detail; 1 mark for an example from this context (such as storing only the name, age and swimming level, and ignoring hair colour or favourite stroke). Answers that are not linked to the leisure centre get 1 mark for each principle at most.
Device-free: pupils answer on paper, then peer-mark with the next slide.
04 · EXAM · MODEL ANSWER
Define it, then apply it
Decomposition breaks the problem into smaller sub-problems that can be solved separately.
For example: choosing a lesson, checking there are spaces, taking payment and sending a confirmation.
Abstraction removes detail that is not needed.
For example: store each swimmer's name, age and level, but not their hair colour or favourite stroke.
MARK SCHEME
1 mark: what decomposition is
1 mark: example in context
1 mark: what abstraction is
1 mark: example in context
Link every example to the leisure centre.
Click to reveal the model answer one part at a time: each definition and each example earns one mark.
Common weak answer: "Decomposition breaks it down and abstraction takes things out." This defines both very loosely and gives no examples from the scenario, so it earns 2 marks at most. Always apply your answer to the context in the question.
Device-free: read the model answer aloud; pupils underline the four mark-earning parts in their own answer.
How sure are you about the three principles?
Very: I can define and apply all three
Fairly: I mix up some of them
Not yet: I need another go
Anonymous exit poll. If many pupils mix up the principles, start lesson 16 with the "which skill?" drag-and-drop again.
Device-free: thumbs up, sideways or down.
05 · NEXT · KEEP GOING
Keep going
Isaac Computer Science
Free online lessons and questions. Look for the computational thinking topic.
BBC Bitesize
GCSE Computer Science, OCR: revise computational thinking.
OCR past papers
J277/02 papers and mark schemes on the OCR website: try the computational thinking questions.
Next lesson: designing algorithms with flowcharts, pseudocode and trace tables.
Point pupils to the three places to practise. Isaac Computer Science and BBC Bitesize are free; OCR past papers and mark schemes are on the OCR website.
Device-free: pupils write down one problem from their own life and decompose it into three sub-problems, to bring to lesson 16.