2. Learning Objectives
• To understand that you can tackle big
problems by breaking them down into
smaller parts using Computational
Thinking.
• To understand the four parts of
Computational Thinking; decomposition,
pattern recognition, abstraction and
algorithms.
• To create your own solutions to problems
using Computational Thinking.
?
3. •Why are we learning? (Purpose & Goals)
We are learning how to overcome complex problems
•How are we learning? (Skills, Techniques, Software, etc.)
We will be using a strategy known as Computational thinking
•What are we learning? (Knowledge)
We are learning the four elements of computational thinking:
• Decomposition
• Pattern Recognition
• Abstraction
• Algorithm
?
4. Key words
• Decomposition: breaking down a complex problem or system into
smaller, more manageable parts.
• Pattern Recognition: looking for similarities among and within
problems.
• Abstraction: focuses on the important information only, ignoring
irrelevant detail.
• Algorithms: a step-by-step solution to the problem, or the rules to
follow to solve the problem.
5. Introduction to Computational Thinking
Computational thinking
allows us to take a
complex problem,
understand what the
problem is and develop
possible solutions. We can
then present these
solutions in a way that a
computer, a human, or
both, can understand.
There are four key
techniques to
computational thinking:
6. How does it work?
Computational thinking involves
taking that complex problem and
breaking it down into a series of small,
more manageable problems
(decomposition). Each of these
smaller problems can then be looked
at individually, considering how
similar problems have been solved
previously (pattern recognition) and
focusing only on the important details,
while ignoring irrelevant information
(abstraction). Next, simple steps or
rules to solve each of the smaller
problems can be designed
(algorithms).
Finally, these simple steps or rules are used
to program a computer to help solve the
complex problem in the best way.
7. Thinking Computationally
• Thinking computationally is not programming. It is not even thinking
like a computer, as computers do not, and cannot, think.
• Programming tells a computer what to do and how to do it.
Computational thinking enables you to work out exactly what to tell
the computer to do.
• Being able to turn a complex problem into one we can easily
understand is a skill that is extremely useful. In fact, it's a skill you
already have and probably use every day.
• Watch the following video:
https://www.youtube.com/watch?v=SVVB5RQfYxk
8. Thinking Computationally Task 1
You are meeting up with a group of friends this afternoon. All of
you like different things, but you have been put in charge of
finding something to do that will keep most of your friends
happy. Think of some questions could you consider in order to
come up with a plan?
Possible questions to consider
E.g. where could you go?
Consider:
Time
Money
Weather
Friends Interests
From this information,
do you think that you
and your friends could
decide more easily
where to go and what to
do – in order to keep
most of your friends
happy?
9. Thinking Computationally Task 2
Look at the videogame screen to
the right. What do you need to
consider in order to complete the
level as efficiently as possible?
From these details you can work out a strategy for completing the level in the most efficient way.
Possible questions to consider
E.g. What items do I need to collect?
10. Thinking Computationally Task 3
Computational Thinking Explanation
Example 1 – Meeting up
with friends
Example 2 – Creating a
computer game
Decomposition
Pattern Recognition
Abstraction
Algorithm
Options of
where to go
Explanation of how to
complete the level
Weather
conditions
Location
of the exit
Including similar
features used within
similar games
What you have previously
done that has been a
success in the past
Where your going to
go, how to get there,
what time to meet
and go home
Ways of getting to the
exit
Developing a step-by-step solution to
the problem, or the rules to follow to
solve the problem.
Focusing on the
important information
only, ignoring irrelevant
detail.
Looking for similarities among and within problems.
Breaking down a complex problem
or system into smaller, more
manageable parts.
Task: Can you put the correct
statements below in the
table? They have been colour
coded to help you!
11. Decomposition
• Decomposition involves breaking
down a complex problem or
system into smaller parts that
are more manageable and easier
to understand. The smaller parts
can then be examined and solved,
or designed individually, as they
are simpler to work with.
• If a problem is not decomposed,
it is much harder to solve.
12. Decomposition Task 1
A crime has been committed. Solving
a crime can be a very complex
problem as there are many things to
consider.
The police officer needs to know the
answer to a series of smaller
problems. Look at the crime scene;
what problems do you think the
police officer needs to consider?
Considerations
13. Decomposition Task 2
How would you decompose the problem of making a sandwich? Think of questions
you need to know the answers to in order to make a sandwich for someone else!
Considerations
14. Developing Decomposition Task 3: Articulate!
• Get into groups of 4, 2 vs 2!
• Each pair gets a pack of articulate cards.
• You have 30 seconds to try and describe as many items
as you can (use the clock feature to time).
• One partner must describe what is on the card without
using the name of the item. If the partner answers
correctly, the team get a point.
• If the name of the item is used the team get -1 point.
• The team with the most points at the end wins!
• Only one pass is allowed per turn. Use it wisely!
15. Pattern Recognition
• When we decompose a complex problem
we often find patterns among the smaller
problems we create. The patterns are
similarities or characteristics that some of
the problems share.
• Pattern recognition is one of the four
cornerstones of Computer Science. It
involves finding the similarities or patterns
among small, decomposed problems that
can help us solve more complex problems
more efficiently.
16. Pattern Recognition Task 1: Sudoku!
The classic Sudoku game involves a grid of 81 squares. The grid is divided into nine blocks, each containing nine
squares. The rules of the game are simple: each of the nine blocks has to contain all the numbers 1-9 within its
squares. Each number can only appear once in a row, column or box.
Use your pattern recognition skills to solve the puzzle!
Rookie Pro BEAST!
17. Why do we need to look for patterns?
• Finding patterns is extremely important.
Patterns make our task simpler. Problems are
easier to solve when they share patterns,
because we can use the same problem-solving
solution wherever the pattern exists.
• The more patterns we can find, the easier and
quicker our overall task of problem solving will
be.
• To find patterns among problems we look for
things that are the same (or very similar) for
each problem.
18. Pattern Recognition Task 2
Look at the two cakes to the below. From the instructions provided can you
identify any similarities in how to prepare them?
Once we have the patterns identified, we can
work on common solutions between the
problems.
Similarity
1
2
3
4
19. Pattern Recognition Task 3
1. Consider a typical week. Write a list of the things you do that are
the same from day to day.
2. How do you think having a pattern with these consistencies benefits
you?
20. Abstraction
Abstraction is the process of filtering out – ignoring - the characteristics
of patterns that we don't need in order to concentrate on those that
we do. It is also the filtering out of specific details. From this we create
a representation (idea) of what we are trying to solve.
Abstraction allows us to create a general idea of what the problem is
and how to solve it. The process instructs us to remove all specific
detail, and any patterns that will not help us solve our problem. This
helps us form our idea of the problem. This idea is known as a ‘model’.
21. How to Abstract Task 1
When baking a cake, there are
some general characteristics. For
example:
• a cake needs ingredients
• each ingredient needs a specified
quantity
• a cake needs timings
When abstracting, we remove
specific details and keep the
general relevant patterns.
General Patterns Specific Details
A Victoria sponge cake has a
layer of strawberry jam in the
middle.
A cake needs ingredients.
Cake needs a specified
time to bake.
It takes 1 hour 45 minutes to
cook a Christmas cake.
Know the specific
ingredient quantities. Banana cake uses 600g of sliced bananas.
Can you add the statements below
into the correct table columns. Some
of them are General Statements,
others are Specific Details.
22. Abstracting Task 2: Football team
Using the statements below, can you identify the ones that are useful (General Patterns)
and those that are not (Specific Details) in in explaining the model of a football team.
General Patterns Specific Details
A football team is
made up of 11
players.
Gareth Bale is a Welsh International player
Players wear a shirt,
shorts, socks and
football boots.
Manchester United’s home kit is Red
A team is made up of a goalkeeper,
defenders, midfielders and forwards.
FC Barcelona play with one goalkeeper, three
defenders, four midfielders and three strikers.
A football team is run by a manager
Roy Hodgson is the England team Manager
23. Algorithms
An algorithm is a plan, a
set of step-by-step
instructions to solve a
problem. If you can tie
shoelaces, make a cup of
tea, get dressed or prepare
a meal then you already
know how to follow an
algorithm.
In an algorithm, each instruction is identified and the order in
which they should be carried out is planned. Algorithms are
often used as a starting point for creating a computer program,
and they are sometimes written as a flowchart or in
pseudocode.
24. Code needs algorithms!
• You use code to tell a computer what to do. Before you write code
you need an algorithm.
• An algorithm is a list of rules to follow in order to solve a problem.
• Algorithms need to have their steps in the right order. Think about an
algorithm for getting dressed in the morning. What if you put on your
coat before your jumper? Your jumper would be on top of your coat
and that would be silly! When you write an algorithm the order of the
instructions is very important.
• Watch the following video: http://www.bbc.co.uk/guides/z3whpv4
25. How do you use algorithms?
People use lots of algorithms every day even if they don’t realise it.
Choose from three problems and guess what the algorithm might be!
We need to make a cake! We can’t find the park! We need to build a toy!
The algorithm here is a cake
recipe. You can find the
algorithm to solve this
problem in a cookbook!
The algorithm you need is a set of
directions to get to the park! There
might be different ways to the park
so you can have different algorithms.
The algorithm to follow here is
the list of instructions that tell
you how to make the toy.
26. Task 1: Clear instructions
• When you write an algorithm you need to
include precise, step-by-step instructions.
• Task: Can you put the following
instructions in order for making a
smoothie:
Add fruit to the blender
Add milk to the blender
Put the lid on the blender
Switch the blender on
Step 1
Step 2
Step 3
Step 4
Imagine if we missed out one of the steps or
reversed the order. We could end up
switching on the blender with nothing in it.
Or there could just be milk in the blender and
no fruit.
That wouldn't make a very tasty smoothie,
would it? In fact, it wouldn't make a smoothie
at all!
27. Representing an Algorithm: Pseudocode
• Pseudocode is not a programming language, it is a simple way of
describing a set of instructions that does not have to use specific
syntax.
• Writing in pseudocode is similar to writing in a programming
language. Each step of the algorithm is written on a line of its own in
sequence. Usually, instructions are written in uppercase, variables in
lowercase and messages in sentence case.
• In pseudocode, INPUT asks a question. OUTPUT prints a message on
screen.
28. Pseudocode Example Task
• A simple program could be created to ask someone
their name and age, and to make a comment based on
these. This program represented in pseudocode would
look like this:
OUTPUT 'What is your name?'
INPUT user inputs their name
STORE the user's input in the name variable
OUTPUT 'Hello' + name
OUTPUT 'How old are you?'
INPUT user inputs their age
STORE the user's input in the age variable
IF age >= 70 THEN
OUTPUT 'You are aged to perfection!'
ELSE
OUTPUT 'You are a spring chicken!'
In programming, > means ‘greater
than’, < means ‘less than’, ≥ means
‘greater than or equal to’ and ≤ means
‘less than or equal to’.
Try it out!
In pairs, one of you is the
computer, the other is the
user. Talk through the
conversation and see if it
makes sense!
29. Task 2: Writing Pseudocode
Using the rules set in the last example, write a pseudocode so that the
computer asks a true or false question. If the user answers true then a
congratulations message is shown, but if the answer is false output a
message to say they were wrong.
Write your pseudocode here:
30. Representing an Algorithm: Flowcharts
• A flowchart is a diagram that represents a set of instructions.
Flowcharts normally use standard symbols to represent the different
instructions.
• There are few real rules about the level of detail needed in a
flowchart.
• Sometimes flowcharts are broken down into many steps to provide a
lot of detail about exactly what is happening.
• Sometimes they are simplified so that a number of steps occur in just
one step.
31. Presenting an Algorithm as a Flowchart
Add 5
Start
Is x > 10?
Process are written in a
rectangular box. It
represents an operation (or
task) to be carried out.
The boxes at the start/end are
written using ‘rounded
rectangles’. A start symbol
represents the start of a
process and produces exactly
one output. An end symbol
represents the end of a process
and has exactly one input.
When the algorithm has to
make a decision, it is
written in a rhombus. It has
one input and two outputs.
These are the basic building blocks of a flowchart algorithm:
Process Decision
Start / End
Arrows are used to
show the direction
of flow within the
algorithm.
True
False
Input Name
Input / Output
Parallelograms show
inputs and outputs
32. Flowchart Example Task
This flowchart
shows the
equivalent code
from the
pseudocode
example!
Try it out!
In pairs, one of you is
the computer, the
other is the user. Talk
through the
conversation and see
if it makes sense!
Start
Output
“What is your name?”
Input
User inputs their name
Store user name
Output
“Hello” + name
Output
“How old are you?”
Input
User inputs their age
Store user’s age
Is age>= 70?
Output
“You’re aged to perfection!”
End
Output
“You’re a spring chicken!”
34. Presenting an Algorithm as a Flowchart
Consider this simple
algorithm for calculating
how old a dog is in dog
years. It contains three
steps, all in sequence
In pseudocode, the algorithm would look like this
OUTPUT 'How old is your dog?'
INPUT user inputs their dog's age in human years STORE the user's
input in the human_years variable dog_years = human_years * 7
OUTPUT 'In dog years, your dog is aged' + dog_years
Representing sequencing in a flowchart?
36. Task 3: Flowchart Creation Output: (Your
question)
False
True
Game show Question
Can you recreate your
pseudocode question into a
flowchart?
The symbols have been
created for you. Fill them in
accordingly.
37. Task 4: Flowchart Practice
• If your lamp doesn’t work, what
would you do?
• Complete the broken lamp algorithm
by adding the sentences below;
1. Buy new lamp
2. Has the bulb burned out?
3. Plug the lamp in
4. Replace the bulb
5. Is the lamp plugged in?
Lamp doesn’t work
True
False
False
True
Broken lamp algorithm
38. Looping
Watch the following video:
https://www.youtube.com/watc
h?v=k0xgjUhEG3U
Is where a statement is
executed in a loop until the
program reaches a certain state
or the intended operations have
been applied.
Looping statements: are
efficient loops that will continue
to loop until the condition is
false.
Iteration
(Loop)
This loop keeps on
repeating until a false
statement is reached.
Start
End
Action 1
Decision
False
True
39. Task 4: Testing a Countdown Clock
The aim of the following loop statement is to create a
countdown clock. The timer is set to 10 then each loop through
it reduces the number by 1 until it gets to 0 and displays “Time
up!”
Start
End
time = time-1
time >0
False
True
Set time to 10
(time=10)
Print “Time
up!”
Timer Step Number
1 10
2 9
At what step would the
statement become FALSE?
Answer:
Test it works
Go through the loop sequence
and see if you get to 0. You can
do this with a Trace Table (the
first part has been started for
you);
40. Applying Computational Thinking:
Supermarket Sweep!
• You have been asked to go to the
supermarket to buy food for the
week.
• But you have agreed to meet friends
later.
• How can you make your trip to the
supermarket as fast as possible while
still getting all the required items?
i.e. how will you make your shop as
efficient as possible?
41. Break down the problem
Computational
Thinking
Application
Decomposition
Pattern
Recognition
Abstraction
Algorithm
Knowing exactly what we
need to buy
Grouping the items into
similar categories
Trialling different routes
through the supermarket
Writing down, step-by-
step, the best route
through the supermarket
Task: how can we apply what we have
learned so far about Computational
Thinking to this problem? Place the
statements below into the correct boxes.
42. Part 1: Decomposition - The shopping list
bananas
milk
bread
apples
eggs
mayonnaise
Tomato
sauce
tea
Cheddar
cheese
oranges
butter
Coffee
potatoes
carrots
croissants
fresh tuna
Minced beef
chicken
This is your shopping list. It
shows a breakdown of every
item you need to get from the
supermarket.
baked
beans
tinned
tomatoes
43. Part 2: Pattern Recognition – Grouping the items
• Consider the items in the
shopping list. Could you group
them into similar categories, for
example, Fruits, Vegetables,
Meat, Dairy etc.
• Colour code or move the items
on the shopping list so that they
are placed within groups.
• Give each group a clear title.
44. Part 3: Abstraction – Trialling routes around the supermarket
• On the next slide you will see the layout of the
supermarket where you will be going to do your shop.
• Considering the items on the shopping list and how
you’ve grouped them, use PowerPoint draw tools to trial
at least three different paths through the supermarket.
• Make sure you collect every item on the shopping list.
• Which route do you think is the quickest? Can you think
of a way of measuring the length of the routes
(Decompose this problem using computational
thinking!!!)?
46. Part 4: Algorithm – Writing down clear instructions
• On the next slide write down a set
of clear instructions to follow in
order to follow your chosen route
through the supermarket as
closely as possible.
• Make sure you remember to say
what items need collecting. These
can be grouped as you have
suggested in Part 2: Pattern
Recognition.
• Add some more lines if required.
48. Part 4: Algorithm - Flowchart
Use the space
below to create
a flowchart of
the instructions
used within the
pseudocode.
Make sure you
use the correct
symbols
dependant on if
you are giving an
instruction for a
process or a
decision.
Another method of presenting an
algorithm is through a flow chart.
Some people find it easier to
demonstrate their plan through this
visual method.
49. Testing
Get three of your classmates to test out your instructions and identify
any problems encountered. Use the table below to record any
problems encountered and what improvements you need to make.
Test Problems Encountered Improvements Made
1
2
3
Go back to your instructions and make any required changes. Change the font
colour to red for any lines of instructions improved.
50. Your turn…
• Using the structures you have learned through Computational
Thinking, choose one of the problems below to solve…
Level Task
Rookie You have to make your own dinner.
Pro Negotiate a typical day at school.
Beast Organise a surprise birthday party for a friend.
Use the following slides to help structure your solution;
51. Computational Thinking Checklist
Level Task Complete
Rookie
Choose the Rookie task
Decomposition – You can break down the task into some sensible parts
Pattern recognition – You consider some patterns
Abstraction – You create a simple overview or model of how you want the solution to work
Algorithm design – You create an algorithm, which includes some sensible instructions.
Testing – Conduct two tests on your algorithm. Make improvements if required.
Pro
Choose the Pro task
Decomposition – You can break down the task into sensible parts
Pattern recognition – You can identify patterns, some of which will help you develop an understanding of the problem.
Abstraction – You create an overview of your solution plan which mostly makes sense.
Algorithm design – You create an algorithm which includes some sensible instructions and logical decision pathways.
Testing - Conduct four tests on your algorithm. Make improvements if required.
Beast
Choose the Beast task
Decomposition – You can break down the task into a range of logical parts
Pattern recognition – You can identify a range of patterns which help you develop an understanding of the problem.
Abstraction – You create a comprehensive and considered overview of your solution which makes sense.
Algorithm design – Your algorithm includes logical decision pathways and sound solutions to complex issues (loops).
Testing - Conduct six tests on your algorithm. Make improvements if required. Loops are tested using a step test table.
52. Break down the problem
Computational
Thinking
Application
Decomposition
Pattern Recognition
Abstraction
Algorithm
53. Part 1: Decomposition
Methods of tackling this task:
• Table
• Sentences
• List
• Mind map
Break down the task into sections. The more sections
you can break the task down into, the clearer an idea
you will have about how to tackle the problem.
54. Part 2: Pattern Recognition
What patterns can you identify within the
task? Are there any consistencies or
common trends within the problem
you’ve chosen? Identify them here!
Methods of tackling this task:
• Table
• Sentences
• List
• Mind map
55. Part 3: Abstraction
Methods of tackling this task:
• Drawings
• Flowchart
• Action plan (Table, list)
What do you want the solution to look
like? This could be a model of the physical
solution or a plan of what you want to
happen.
56. Part 4: Algorithm - Flowchart
Create a step by step explanation of how
you will tackle the problem. How will you
make the decision? Remember to use the
correct symbols!
57. Step Part 4: Algorithm - Pseudocode
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
As an
alternative to
a flowchart,
you can write
your
instructions
in
pseudocode.
58. Testing
Test Which part did you test? Were there any problems? Did you make any
improvements?
1
2
3
4
5
6
Test your algorithm
Rookie: Conduct two tests on your algorithm.
Pro: Conduct 4 tests on your algorithm.
Beast: Conduct 6 tests on your algorithm. Test loops using a step test table (next page).
Change the font colour to red for any lines of instructions improved.
59. Step test tables (Beast)
Step Value Step Value Step Value
Title: Title: Title:
60. Review
Question Answer
What did you do in order to decompose the
problem?
What patterns did you recognise from this?
How did you use abstraction effectively?
What method did you use to write your
instructions? Why did you choose this method?
What parts of your algorithm did you test? Did
you find any errors?
What improvements did you make as a result of
testing?
Notes de l'éditeur
Some example ideas:
what you could do
where you could go
who wants to do what
what you have previously done that has been a success in the past
how much money you have and the cost of any of the options
what the weather might be doing
how much time you have
Examples:
what items you need to collect, how you can collect them, and how long you have in which to collect them.
where the exit is and the best route to reach it in the quickest time possible
what kinds of enemies there are and their weak points
e.g.
what crime was committed
when the crime was committed
where the crime was committed
what evidence there is
if there were any witnesses
if there have recently been any similar crimes
What type of bread do you want?
Do you want butter?
What do you want in the sandwich?
Do you want it cut in half, squares or not at all?
Do you want it toasted?
How quickly do you want the sandwich?