Computational Thinking: How Do We Think About Problems So That Computers Can Help?
Computational Thinking: How Do We Think About Problems So That Computers Can Help?
Computational
Thinking
How do we think about problems so that
computers can help?
CONTENTS E
»
Computational Thinking
1 The Barefoot Computing developed by Computing At School (CAS) for primary teachers refers to 'patterns' here, but the
term 'generalisation' was used in CAS's computational thinking working group (see Czismadia et al., 2015).
CONTENTS 5
»
Computational Thinking
Figure 1.1
Barefoot would like to acknowledge the work of Julia Briggs and the eLIM team at Somerset County Council for their contribution to this poster and Group DRP for their work on the design.
CONTENTS 6
»
Computational Thinking
curriculum in secondary education. It’s worth making Computational thinking should not be seen as
these connections explicit during computing lessons, just a new name for ‘problem-solving skills’. A key
drawing on the applications of computational element of computational thinking is that it helps us
thinking that your students will already be familiar make better use of computers in solving problems
with, as well as discussing these ideas with your and understanding systems. It does help to solve
colleagues teaching other subjects. For example: problems and it has wide applications across other
disciplines, but it is most obviously apparent, and
●● In English, students are encouraged to plan their probably most effectively learned, through the
writing, to think about the main events and rigorous, creative processes of writing code – as
identify the settings and the characters.
discussed in the next section.
●● In art, music or design and technology, students
think about what they are going to create and
how they will work through the steps necessary
for this, by breaking down a complex process
into a number of planned phases.
Classroom activity ideas
●● In maths, pupils will identify the key information
in a problem before they go on to solve it. ●● Traditional IT activities can be tackled from
a computational thinking perspective. For
example, getting students to create a short
Where does computational video presentation might begin by breaking the
thinking fit in the new project down into short tasks (decomposition),
thinking carefully about the best order in which
computing curriculum? to tackle these and drawing up a storyboard for
the video (algorithms), learning about standard
techniques in filming and editing and recognising
The national curriculum for computing puts how others’ work could be used as a basis or
computational thinking right at the heart of its even included here (generalisation), learning
ambition. It states: about, but not being overly concerned about
technical elements of cameras and file formats
A high-quality computing education (abstraction).
equips pupils to use computational ●● If your school has cross-curricular projects or
thinking and creativity to understand theme days, see if you can adopt a computational
and change the world. (Department for thinking approach to one of these. Take, as an
Education [DfE], 2013) example, putting on an end of year play: students
could break the project down into a set of sub
Indeed, computational thinking remains part of the tasks, consider the order in which these need
statutory curriculum entitlement for all up to the to be accomplished, assign tasks to individuals
end of Key Stage 4: or groups and review how work is progressing
towards the final outcome.
All pupils should be taught to … develop ●● There are strong links between computational
and apply their analytic, problem-solving, thinking and the design–make–evaluate approach
design, and computational thinking skills. that’s common in design and technology, and
(DfE, 2013) sometimes in other subjects.
CONTENTS 7
»
Computational Thinking
CONTENTS 8
»
Computational Thinking
Boolean logic
Figure 1.4
CONTENTS 9
»
Computational Thinking
A B Output Q Or
False False False
if (time remaining < 0) or (health < 0) then (game
False True False over)
True False False
True True True When used in combination with binary
representation, logical operators can be applied to
OR: each bit in binary numbers – we call these ‘bitwise’
operators – and this can be in quickly isolating
particular parts of a byte or word; for example to
get just the two least significant bits of a byte, AND
the byte with 0b00000011.
CONTENTS 10
»
Computational Thinking
addition upwards can be carried out by digital Boolean logic, although some will have had a little
circuits made from just combining AND, OR and experience of using logical operators in Scratch or
NOT gates. other programming at primary school. They should
‘understand simple Boolean logic [for example,
It is because everything a computer does is AND, OR and NOT] and some of its uses in circuits
controlled by logic that we can use logic to reason and programming’.
about program behaviour.
Logic has played a part in the school curriculum
Software engineers use logical reasoning all the time from classical times onwards, and your colleagues
in their work. They draw on their internal mental can do much to develop and build on pupils’
models of how computer hardware, the operating logical reasoning. For example, in science pupils
system (such as Windows 10, OS X) and the should explain how they have arrived at their
programming language they are using all work, in conclusions from the results of their experiments;
order to develop new code that will work as they in mathematics, they reason logically to deduce
intend. They will also rely on logical reasoning when properties of numbers, relationships or geometric
testing new software and when searching for and figures; in English, citizenship or history they might
fixing the ‘bugs’ (mistakes) in their thinking (known look for logical flaws in their own or others’
as debugging – see page 35 & 77) or their coding arguments.
when these tests fail.
CONTENTS 11
»
Computational Thinking
●● Pupils should make use of logic operators in Cryan, D., Shatil, S. and Mayblin, B. (2008) Introducing
selection statements when programming – game logic: A graphic guide. London: Icon Books Ltd.
programs, for example text based adventures,
provide many opportunities for this. Pupils could McInerny, D. (2005) Being logical: A guide to good
also experiment with bitwise logical operators thinking. New York, NY: Random House.
in Python or TouchDevelop, or create blocks for
other logical operators such as NAND and XOR McOwan, P. and Curzon, P. (n.d.) Brain-in-a-bag:
in Snap! Creating an artificial brain. Available from www.cs4fn.
●● Ask pupils to think carefully about some org/teachers/activities/braininabag/braininabag.pdf
school rules, for example those in the school’s
computer Acceptable Use Policy. Can they The P4C Co-operative (n.d.) A co-operative providing
use logical reasoning to explain why the rules resources and advice on philosophy for children.
are as they are? Can they spot any logical Available from www.p4c.com/
contradictions in the policy?
●● There are many games, both computer-based and PhiloComp.net (n.d.) Website highlighting the strong
more traditional, that draw directly on the ability links between philosophy and computing. Available
to make logical predictions. Organise for the from www.philocomp.net/
pupils to play noughts and crosses, Nim or chess.
As they are playing, ask them to predict their
opponent’s next move. Let them play computer
games such as Minesweeper or SimCity, as
Algorithms
appropriate. Ask them to pause at certain points
and tell you what they think will happen when
they move next. Consider starting a chess club if
What is the best way to
your school doesn’t already have one. solve a problem?
Dijkstra's algorithm does a much better job of house between human language and a programming
finding the shortest route, and, subject to some language, borrowing many of the characteristics of
reasonable assumptions, there are even faster the latter, whilst allowing some details to be left as
algorithms now.(2) implicit:
CONTENTS 13
»
Computational Thinking
Given the extent to which so much of their lives In developing your pupils’ understanding of key
is affected by algorithms, it is worth pupils having algorithms, you might start with ‘unplugged’
some grasp of what an algorithm is. approaches, in which pupils get a good feel for how
an algorithm operates, for example by playing ‘guess
Where do algorithms fit in the the number’ games or by sorting a set of masses
into order using a pan balance. It can also be very
computing curriculum? useful for pupils to work through the steps of an
algorithm, perhaps expressed as flowcharts or
pseudocode, for themselves using pencil and paper.
At primary school, the computing curriculum This was the approach advocated by Donald Knuth
expects pupils in Key Stage 1 to have an (1997) in The art of computer programming, when
understanding of what algorithms are, and how he wrote that:
they are used in programs on digital devices. Often
young pupils will be introduced to the idea of an An algorithm must be seen to be
algorithm away from computers, in ‘unplugged’ believed, and the best way to learn what
classroom contexts. Pupils will go on to recognise an algorithm is all about is to try it.The
that the same algorithm can be implemented as reader should always take pencil and
code in different languages and on different systems, paper and work through an example
from Bee Bots to Scratch Jr (Figure 1.6). of each algorithm immediately upon
encountering it.
CONTENTS 14
»
Computational Thinking
Search
Imagine trying to find the definition of a word
in a dictionary – we have a number of possible
approaches:
4 See, for example, David J. Malan's demonstration for Harvard's CS50: https://youtu.be/zFenJJtAEzE?t=16m35s
CONTENTS 15
»
Computational Thinking
This recursive technique of reducing a problem It is well worth getting pupils to think about this
to a simpler problem and then applying the same problem for themselves, perhaps initially as an
algorithm to that is called divide and conquer, unplugged activity, sorting a group of their peers
and it is an excellent example of an algorithmic into height order or by birthday or using numbered
pattern that can be applied in lots of different slips of paper or a pan balance and pots with hidden
contexts, including classical search problems like masses.You can do this as a programming task once
this, finding highest common factors (see Euclid’s pupils have learnt how to manipulate a list in the
algorithm on page 64), sorting a list of numbers (see programming language you are teaching, but as with
quicksort and merge sort on pages 71 - 73) and any programming it’s wise to have planned how to
parsing algebraic expressions, computer code or solve the problem (that is, the algorithm) before
even natural language.(5) working with code.
It is worth noting that binary search only works There is quite a variety of sort algorithms around,
if the list is already in order: finding a word in a some are much more efficient than others, and
dictionary this way is only possible if the dictionary some are certainly easier to understand than
is already in alphabetical order. For an un-sorted others. For computing, it’s worth teaching at least
list it would be hard to do better than starting at a couple so that pupils can use logical reasoning to
the beginning and working through to the end using compare them. Selection sort or bubble sort are
linear search. Similarly, for the guess a number game, good starting points, but ideally include quicksort
we can use this method because numbers are in or merge sort so that pupils can see how some
order and we can ask the ‘is it less than’ question. algorithms are more efficient than others for the
same problem.
The problem of searching for information on the
web (see pages 123 - 124) is obviously much more Selection sort
complex than simply finding a word in a dictionary
or a secret number in a game, but even here one This is quite an intuitive approach.
of the problems a search engine needs to solve is ●● Start with a list.
looking up the results in its index of the web for
●● Find the smallest item* and swap it with the item
each of the keywords typed in by the user.
in the first place.
Sort ●● Now, starting with the second item, look for the
next smallest and swap it with the item in the
In order to find things in a list quickly, time after second place.
time, it’s really helpful if that list is in order. Imagine ●● Starting with the third item, look for the next
the problem of finding an email if all your messages smallest and swap it with the item in the third
were in some random sequence, or of finding a place.
document on a computer if there was no way to ●● Keep doing this until you get to the last item.
sort a folder’s contents into order, or of finding a
* finding the smallest at each step involves
contact on your phone if each time you had to look
comparing the smallest-so-far with all the other
through a randomly-ordered list of everyone you
items after it until the end of the list, at which point
knew, or of finding a book in the school library if
the smallest-so-far must be the smallest of the
they had never been put into any order. There are
group.
many, many areas where a list in some natural order
seems an intuitive way to organise information. Try it for yourself!(6) Can you use logical reasoning
Notice that once a list is in order adding a new to work out how this works? Could you explain the
item into the list is easy – you just search for the idea here to your pupils? Could you work out how
right place, add the item and shuffle everything many comparisons you would have to make to sort
afterwards along a place. Getting the list into order a list of 10 things?(7)
in the first place is another matter.
5 See https://en.wikipedia.org/wiki/Divide_and_conquer_algorithms
6 See the Harvard CS50 demonstration at www.youtube.com/watch?v=f8hXR_Hvybo
7 9+8+7+6+5+4+3+2+1=45.
CONTENTS 16
»
Computational Thinking
CONTENTS 17
»
Computational Thinking
CONTENTS 18
»
Computational Thinking
CONTENTS 19
»
Computational Thinking
Peyton Jones, S. (2014) Decoding the new computing Software development is a complex process and
programmes of study. Computing at School. Available so being able to break down a large project into
from http://community.computingatschool.org.uk/ its component parts is essential – think of all the
resources/2936 different elements that need to be combined to
produce a program like PowerPoint.
Slavin, K. (2011) How algorithms shape our world. TED.
Available from www.ted.com/talks/kevin_slavin_ The same is true of computer hardware (see Figure
how_algorithms_shape_our_world?language=en. 1.11): a smartphone or a laptop computer is itself
composed of many components, often produced
Steiner, C. (2013) Automate this: How algorithms came independently by specialist manufacturers and
to rule our world. New York, NY: Portfolio Penguin. assembled to make the finished product, each
under the control of the operating system and
applications.
CONTENTS 20
»
Computational Thinking
CONTENTS 21
»
Computational Thinking
16 See https://scratch.mit.edu/projects/72176670/
17 See https://trinket.io/python/8996e36dda
CONTENTS 22
»
Computational Thinking
●● Take the case off an old desktop computer Project Management Institute Educational
and show the pupils how computers are made Foundation (2011) Project management toolkit for
from systems of smaller components connected youth. Available from http://pmief.org/learning-
together. Depending on the components resources/learning-resources-library/project-
involved some of these can be disassembled management-toolkit-for-youth.
further still, although it is likely to be better to
look at illustrations of the internal architecture
●●
of such components.
Organise for the pupils to carry out a
Abstraction
collaborative project online, for example
through developing a multi-page wiki site. For
example, pupils could take the broad topic of
How do you manage complexity?
e-safety, decompose this into smaller parts and
then work collaboratively to develop pages for For American computer scientist Jeanette Wing,
their wiki, exploring each individual topic. The
credited with coining the term computational
process of writing these pages can be further
decomposed through planning, research, drafting, thinking, abstraction lies at the heart of this:
reviewing and publishing phases.
The abstraction process – deciding
●● Introduce pupils to divide and conquer what details we need to highlight and
approaches and other applications of what details we can ignore – underlies
recursion through binary search, quicksort and computational thinking. (Wing, 2008)
experimenting with simple fractals using turtle
graphics. Encourage them to look out for other Abstraction is about simplifying things; identifying
occasions on which this powerful technique can
be used. what is important without worrying too much
about the detail. Abstraction allows us to manage
complexity.
CONTENTS 23
»
Computational Thinking
In computing, we work simultaneously happening inside a computer when they press a key
with at least two, usually more, layers of and the corresponding letter appears on screen
abstraction: the layer of interest and the in their word processor or text editor. Similarly,
layer below; or the layer of interest and pupils’ knowledge of how search engines work or
the layer above. Well-defined interfaces how web pages are transmitted across the internet
between layers enable us to build large, is going to draw on their understanding of the
complex systems. (Wing, 2008) many different layers of systems on which these
processes depend.
Programming also makes use of abstraction – in
modular software design, programmers develop In Key Stage 3, abstraction is an intrinsic part of
procedures, functions or methods to accomplish developing computational solutions to real world
particular goals, sometimes making these available problems, as pupils focus attention on the detail
to others in libraries. What matters is what the of the real world problem or system, deciding for
function does and that it does this in a safe and themselves what they won’t need to take account
reliable way; the precise implementation details are of in the algorithms, data structures and programs
much less important. that they develop. The programme of study includes
the requirement to:
Where does abstraction fit in design, use and evaluate computational
the new computing curriculum? abstractions
CONTENTS 24
»
Computational Thinking
●● Take cards sequentially, one from the top, one ●● Any live cell with more than three live
from the bottom to assemble a new pack. neighbours dies.
●● Repeat until there are no cards remaining in the ●● Any dead cell with exactly three live neighbours
top or bottom. becomes a live cell.
This describes the behaviour of our system, but Thus, for example, the pattern
any abstraction also needs to include the state of
the system, which is simply an ordered list of the
cards in the pack. Working with a deck of just eight
cards, we might start with:
A, 2, 3, 4, 5, 6, 7, 8
A, 5, 2, 6, 3, 7, 4, 8
18 Things in Minecraft are somewhat more sophisticated than this. See http://minecraft.gamepedia.com/Chunk_format
for details of the data structure used, or explore this in Minecraft for the Raspberry Pi:
www.raspberrypi.org/learning/getting-started-with-minecraft-pi/worksheet/
19 Computer implementations of Life include Golly: http://golly.sourceforge.net/
CONTENTS 25
»
Computational Thinking
As well as the list that represents the state of a edges connect nodes in one direction but not the
pack of cards and the two-dimensional array that other – for example, the links between web pages
represents the state of cells in Life, the graph is a or followers on Twitter. In some cases we attach
particularly useful data structure that can be used numbers or weights to the edges, for example so
in a wide variety of computational abstractions. that we can work out the shortest path between
A graph consists of nodes connected by edges. (A two nodes, as in the sat nav example earlier (page
graph, in this sense, is quite different from the sort 12). There are many examples of problems which
of statistical charts or diagrams which pupils might appear initially very complex (such as the Knight’s
be familiar with. The same technical term ‘graph’ is Tour in chess [Curzon, 2015]) but become very
used for two completely different things.) much simpler to solve using standard algorithms
when represented as graphs. Graphs are particularly
general sorts of structures: lists, arrays and trees
(such as in our binary search example on page 15)
can all be thought of as special sorts of graphs.(21)
Languages such as Snap!, Python and Mathematica
have libraries available for working with graphs.
20 See http://oracleofbacon.org/how.php
21 Conversely, graphs can be represented as lists of edges or arrays of node connections.
22 From CS Unplugged: http://csunplugged.org/wp-content/uploads/2014/12/unplugged-11-finite_state_automata.pdf
CONTENTS 26
»
Computational Thinking
At Key Stage 3, there is the expectation that pupils BBC Cracking the Code (2013) Simulating the
will be drawing on the ideas of decomposition and experience of F1 racing through realistic computer
abstraction by developing software with a modular models. Available from www.bbc.co.uk/programmes/
architecture using procedures or functions, or drawing p016612j
on procedures or functions developed by others.
Procedures and functions are covered on pages 63 - Computerphile (2013) The art of abstraction –
67. Computerphile. Available from www.youtube.com/
watch?v=p7nGcY73epw
●● Without using computers to think about CS4FN (n.d.) Download our computer science
programming, set pupils the challenge of magic books! Available from www.cs4fn.org/magic/
designing interesting playable games, thinking magicdownload.php
carefully about the state (typically, board, card
deck, die) of their game and its behaviour (the CS4FN (2016) Computational thinking: Puzzling
rules or algorithm, according to which play takes tours. Available from https://cs4fndownloads.files.
place). Pupils might start by adapting the state wordpress.com/2016/02/puzzlingtours-booklet.pdf
and behaviour of games they are already familiar
with (Noughts and Crosses, Nim, Draughts, Google for Education (2013) Solving problems at
Pontoon).
Google using computational thinking. Available from
●● In programming, you might ask pupils to create www.youtube.com/watch?v=SVVB5RQfYxk
their own games. If these are based on real-
world systems then they will need to use some Kafai,Y. B. (1995) Minds in play: Computer game
abstraction to manage the complexity of that design as a context for children’s learning. Mahwah, NJ:
system in their game. In a simple table tennis Lawrence Erlbaum.
game, for example Pong, the simulation of the
system’s behaviour includes the ball’s motion in
two dimensions and how it bounces off the bat,
but it ignores factors such as air resistance, spin
Patterns and
or even gravity: the state of the system might be
modelled by coordinates to specify the position Generalisation
of the ball and the bats, as well as each player’s
How can you make things
score.
Whilst developing an app is an ambitious project
easier for yourself?
●●
in Key Stage 3, designing apps is accessible to
most pupils: they can take the idea of a finite
state machine and apply it to designing the
screens of their app and the components of the There is a sense in which the good software engineer
user interface which allow the app to move from is a lazy software engineer, although this isn’t the
one screen to another. same as saying that all lazy software engineers are
good software engineers! In this case, being lazy
means looking for an easier way to do something:
partly this is about efficient algorithms, for example
Further resources looking for a quicker way for the computer to do
something, but it’s also about not doing unnecessary
work yourself.
Barefoot Computing (2014) Abstraction. Available
from http://barefootcas.org.uk/barefoot-primary- In the long run it can save lots of time to come
computing-resources/concepts/abstraction/ (free, up with a solution to a general class of problems
but registration required). and apply this to all the individual problems in
that class, rather than solving each of these as an
BBC Bitesize (n.d.) Abstraction. Available from www.
entirely separate problem. For example, in learning
bbc.co.uk/education/guides/zttrcdm/revision
about area, pupils could find the area of a particular
CONTENTS 27
»
Computational Thinking
rectangle by counting the centimetre squares on the based on the patterns we spot in our day to day
grid on which it is drawn. It’s better to realise that in professional experience.
each case all we need do is multiply the length by the
width: not only is this quicker, it’s also a method that The term ‘pattern’ has another meaning in software
will work all rectangles, including really small ones engineering: it also refers to common approaches
and really large ones. Although it takes a while for to solving the same problem. Taking inspiration from
pupils to understand this formula, once they do it’s A pattern language by Alexander et al. (1977), which
so much faster than counting squares. sought to document good solutions to common
problems in architecture and urban design, Gamma
In computing, this method of looking for a and three colleagues (‘The Gang of Four’) published
general approach to a class of problems is called a very influential set of 23 classic software design
generalisation. It is dependent on the ability to patterns for object oriented programming (Gamma
spot patterns in the class of problems that you are et al., 1994). Examples of these design patterns
working with: in the areas example, a child might include ‘iterator’, which accesses the elements of an
well come to spot the relationship between the object sequentially without exposing its underlying
length and width of the rectangles and the number representation and ‘memento’, the ‘undo’ behaviour
of centimetre squares they contain, suggesting a rule which provides the ability to restore an object to
they can use for other rectangles too. In computing, its previous state. Further design patterns have
in the early days of the web, directories of all the been written up since and the approach has been
best sites were compiled to help people discover applied to other domains too, including teaching
the pages they needed. The general rule for these (Laurillard, 2012).
lists might be to include those websites which lots
of people used or linked to, and that’s a pattern One particularly useful design pattern for developing
which can be used to produce a general solution software, including apps and games, is the ‘model-
to the problem automatically by search engines view-controller’ pattern – the model here is the
such as Google or Bing. Rather than individual part of the program that captures the computational
editors compiling long lists of relevant web pages, abstraction of the state and the behaviour of the
an algorithm can apply the general rule of finding system; the view is the part of the program which
the most linked to pages with a particular phrase displays the state of the system to the user; the
automatically to its indexed cache of the web. controller is the part that allows the user to control
the behaviour of the system. This pattern is the basis
In computer science, the field of machine learning for most software that relies on user interaction via
has taken this idea of recognising patterns and a graphical user interface (GUI) (Michaelson, 2016).
made this something which computers can do.
With a large enough database, it is possible for Generalisation is one of the reasons why
algorithms to spot patterns in the data which appear computational thinking is so important beyond
to be related to particular outcomes. For example, the realms of software engineering or computer
Amazon’s algorithms can spot the patterns in the science. Wing argues that computational thinking for
data of all their customers’ buying and browsing everyone includes being able to:
habits to suggest which products another customer
Apply or adapt a computational tool or
might be interested in. We are already starting
technique to a new use,
to see these ideas being applied in education –
with enough data available, the patterns in pupils' Recognize an opportunity to use
interactions with online questions can be used computation in a new way, and
to suggest helpful activities for pupils to try next,
in much the same way that teachers might make Apply computational strategies such
‘intuitive’ judgements based on past experience divide and conquer in any domain. (Wing,
of how best to teach a topic to the individuals in 2010)
their class. Of course these judgements aren’t really
‘intuitive’: because thinking every situation through All of which are directly linked to this element of
logically, in such a way that we can give a rational computational thinking.
explanation for our decision, is time consuming
and difficult, we create our own ‘rules of thumb’
CONTENTS 28
»
Computational Thinking
Figure 1.21
CONTENTS 29
»
Computational Thinking
CONTENTS 30
»
Computational Thinking
In the Computing At School guide to computational Evaluation also needs to consider the implementation
thinking, the authors write: of the algorithm and associated data structures
as code. Part of this involves carefully and logically
Evaluation is the process of ensuring that reviewing the code to ask whether it does what it
a solution, whether an algorithm, system, should do, but also whether it’s good code. Good
or process, is a good one: that it is fit for code is likely to be well formatted and commented, so
purpose.Various properties of solutions that it’s easier for others to read and review.Variables
need to be evaluated. Are [they] correct? and functions or procedures will have useful, sensible
Are they fast enough? Do they use resources names. It’s likely to make use of decomposition and
economically? Are they easy for people abstraction through a modular approach. Good code
to use? Do they promote an appropriate is likely to use a simple, sensible, obvious way to get
experience? Trade-offs need to be made, as things done, drawing perhaps on some of the classic
there is rarely a single ideal solution for all design patterns; it shouldn’t make a reviewer wonder
situations.There is ... attention to detail in ‘why did they do it like that?’ Good code is also likely
evaluation based on computational thinking. to make good use of the features of the language it is
(Csizmadia et al., 2015) written in, particularly the available function libraries.
Knuth argues for literate programming, in which
Evaluation though isn’t just for computer scientists
programmers document the logical argument and
or software engineers. As users of technology, it’s
design decisions of their programs, illustrating these
important that everyone consider whether the
with the source code (Knuth, 1992).
software and hardware available is fit for purpose,
and recognise the limits of what computers can do. As well as reasoning about and understanding code,
Wing argues that computational thinking means evaluation also has to involve testing code. Good
that everyone should be able to: practice, in programming if not always in education, is
to test early and often: as each part of a program is
Evaluate the match between
written, it should be tested to see that it does exactly
computational tools and techniques and a
what it’s supposed to do. Modular programming,
problem [and] understand the limitations
typically involving functions or procedures, makes it
and power of computational tools and
easier to test code as it’s being developed, as each
techniques. (Wing, 2010)
function or procedure can be tested independently of
The multi-layered abstraction common to the rest of the program.
computational thinking provides one way of
Test-Driven Development (TDD) is an agile
thinkingthrough the evaluation of a computational
programming methodology in which the tests for
solution.
features are written first before the new features
At the most fundamental level, the algorithms that are developed.There’s a three-phase cycle here
lay at the heart of the solution must be correct, and (Figure 1.22): at first the test should fail (as the new
here logical reasoning can be used to provide proof feature hasn’t been implemented yet), then the test
that, given the correct input data, the algorithm will should pass (as the feature has been implemented
produce the correct output data. Alongside the successfully), and then there’s often the need to
algorithms governing the behaviour of the solution, refactor the already working code so that it’s better
the underlying abstraction must also reflect the integrated or more efficient.There are parallels here
state of the problem or system we are working with assessment for learning in schools: check first
with. In the process of developing a computational what pupils don’t know; teach them; check again that
abstraction, some information is put to one side, they’ve learnt this (providing evidence of progress);
reducing the complexity of the problem: the then ensure that they develop fluency and mastery in
process of evaluation involves considering whether the new content.These tests are typically automated
the choices in reducing complexity were well- – we work out in advance what a function or
made. Computational abstractions also involve procedure should do given different input data, and
choices over how data are to be structured and then check that it does indeed return the expected
represented, and again evaluation should consider output.
whether such choices were correct and optimal.
CONTENTS 31
»
Computational Thinking
CONTENTS 32
»
Computational Thinking
Evaluating the utility of an algorithm is also about flaws in arguments, unsubstantiated claims, vested
judging the algorithm’s efficiency. The ‘random interests and other forms of bias. Whilst there
driver’ approach to finding a path through a are perhaps inevitably some subjective elements
graph may eventually work, but it is unlikely to be to evaluating the design of a digital artefact, there
much help when driving to Birmingham in time are also principles which seem common to much,
for a meeting. The examples earlier of different even if not all, good design: simplicity, symmetry,
algorithms for searching, sorting or other problems consistency, proportion, attention to detail, fitness
provide ample scope for pupils to learn about this. for purpose, honesty, inclusion and sustainability.(26)
Notice that the curriculum talks here of using Evaluating usability is about considering how well
logical reasoning: evaluating algorithms should start an artefact meets the needs of its intended users:
with thinking about them, rather than by rushing to doing this demands some empathy with those users.
implement them as code. Can pupils explain to you Encourage pupils to take an inclusive approach to
or to one another why a binary search will be more usability, considering how well an artefact would
efficient than a linear search? Can they explain why meet the needs of a diverse group of users – those
quicksort gets its name? There’s something to be whose first language isn’t English, those who are
gained by letting pupils implement these algorithms visually impaired, those for whom fine motor
as code and to see for themselves the difference in control is difficult or impossible.
how long their programs take to complete – bubble
sort and quicksort programs in Snap! will have
appreciably different run times if given lists of 100
Activities
random integers to sort.
As well as evaluating abstractions and algorithms, ●● Get pupils to do code reviews for one another.
pupils should also learn to evaluate the digital Given a problem, pupils should write programs
artefacts that they make. When pupils develop, to solve it and add comments to their code. They
create, reuse, revise and repurpose digital should then review a solution written by one of
artefacts, they do so for a given audience, and their peers, evaluating how well they have solved
evaluation should consider the extent to which the problem and providing constructive, critical
they have met the needs of these known users. feedback on their solution.
These needs should feed into the design process ●● Again in programming activities, pupils should be
from the start, perhaps in terms of specifications able to create tests for the correctness of their
or criteria against which the eventual product or code, determining by hand what output should
prototype might be judged, but also perhaps as follow from particular input data and then testing
the ‘user stories’ which play a similar role in agile to see whether their code performs correctly.
development (see pages 37 - 38), often expressed in ●● Encourage pupils to be constructively critical of
the form ‘As a __, I want __ so that __.’ It’s worth websites, software and systems that they use –
giving pupils a genuine experience of developing for how might these be improved? Have they found
actual users at some point in Key Stage 3 – perhaps any bugs? In many cases, particularly open source
from their peer group or for parents at the school software projects, users can play an important
or for younger children.(25) Evaluation in terms of role in software development by submitting bug
reports or feature requests.
meeting the needs of known users can then involve
trying out the product or prototype with these ●● Using keyboard-only input, using just a screen
users, observing their interactions and listening to reader for output or swapping the language
their feedback. settings for a program into another language
would give pupils an insight into the challenges
The programme of study also expects attention of designing and developing with accessibility in
mind.
to be paid to trustworthiness, design and
usability when using or developing digital artefacts.
Evaluating trustworthiness can help develop pupils’
logical and critical reasoning, as they come to
consider internal and external consistency, logical
CONTENTS 33
»
Computational Thinking
CONTENTS 34
»
Computational Thinking
it with one another, rather than you explaining improvements. There’s evidence that learning
exactly how it works. Also, look for ways in from mistakes is a particularly effective approach
which pupils can use others’ code, from you, their and the process of pupils debugging their own
peers or online as a starting point for their own or others’ code is one way to do this. A positive
programming projects. attitude towards mistakes as learning opportunities
and taking responsibility for fixing them can help
Creating develop pupils’ resilience and contribute towards
a ‘growth mindset’ (Dweck, 2006; qv Cutts et al.,
Programming is a creative process. Creative work
2010), as Papert observed:
involves both originality and making something of
value: typically something that is useful or at least fit The question to ask about the program
for the purpose intended. is … if it is fixable. If this way of looking
at intellectual products were generalised
Encourage pupils to approach tasks with a creative
to how the larger culture thinks about
spirit, and look for programming tasks that allow
knowledge and its acquisition, we all might
some scope for creative expression rather than
be less intimidated by our fears of ‘being
merely arriving at the right answer.
wrong’. (Papert, 1980)
Encourage pupils to reflect on the quality of the
Keep an eye on the bugs that your pupils do
work they produce, critiquing their own and others’
encounter, as these can sometimes reveal particular
projects. The process of always looking for ways
misconceptions that you may need to address.
to improve on a software project is becoming
common practice in software development. Debugging is discussed in more detail on pages 77
Look for projects in which artistic creativity is - 79.
emphasised, such as working with digital music,
images, animation, virtual environments or even 3D Persevering
printing.(27)
Computer programming is hard. This is part of
Creating need not be confined to the screen: there its appeal – writing elegant and effective code
is ample scope at Key Stage 3 to introduce pupils is an intellectual challenge requiring not only
to electronic circuits, microcontrollers, wearable an understanding of the ideas of the algorithms
electronics and simple robotics. Platforms such as being coded and the programming language you’re
the BBC micro:bit and the Raspberry Pi make this working in, but also a willingness to persevere with
sort of activity more accessible than ever at school, something that’s often quite difficult and sometimes
and there are many extra-curricular opportunities very frustrating. There’s evidence that learning
for pupils such as hack days, Coder Dojos(28) and is more effective when there are challenges to
Raspberry Jams.(29) overcome, in part because we then have to think
more (Bjork and Bjork, 2011).
Debugging
Carol Dweck’s work on ‘growth mind-sets’ suggests
Because of its complexity, the code programmers’ that hard work and a willingness to persevere in the
write often doesn’t work as intended. face of difficulties can be key factors in educational
outcomes. Encourage pupils to look for strategies
Getting pupils to take responsibility for thinking
they can use when they do encounter difficulties
through their algorithms and code, to identify and
with their programming work, such as working
fix errors is an important part of learning to think,
out exactly what the problem is, searching for the
and work, like a programmer. It’s also something
solution on Google or Bing, or on Stack Overflow
to encourage across the curriculum: get pupils
or Stack Exchange, or asking a friend for help.
to check through their working in maths or to
proofread their stories in English. Ask pupils to
debug one another’s code (or indeed proofread one
another’s work), looking for mistakes and suggesting
CONTENTS 35
»
Computational Thinking
Software engineering(30)
CONTENTS 36
»
Computational Thinking
code rigorously, making sure that it has no bugs and There are parallels between the design–code–
that it meets the detail outlined in the specification test–evaluate cycle of iterative development
and the original requirements. There’s usually a fifth and the plan–teach–assess–evaluate cycle for
stage in commercial waterfall development in which teaching that many teachers and schools now use
the software house undertakes to maintain the routinely (Figure 1.25). Similarly, just as assessment
program, updating it if necessary to meet changing for learning has produced a tight loop between
requirements. Waterfall methods are still used for teaching and assessing, so that the results of
some big, public sector software deployments. formative assessment feed directly into how the
rest of the lesson or unit of work proceeds, so in
This approach has something in common iterative development, there’s a tight loop between
with curriculum development – moving from coding and testing – as bugs become apparent in
requirements that children should be taught testing, they get fixed through more coding.
computer science, IT and digital literacy through a
detailed specification of programmes of study to
implementation through schemes of work, lesson
plans and activities to testing and evaluation, with
further support there if necessary.
Iterative development
Figure 1.25
Agile methods
Figure 1.24
31 http://agilemanifesto.org/
CONTENTS 37
»
Computational Thinking
‘minimum viable product’ and then developing this It’s perhaps best to let pupils have some experience
further in response to changing needs and rapidly of all three of these methodologies. For some
developing technologies has made this approach programming projects, you may only have time
popular with many working in technology based to work through from planning to debugging
start-ups, as well as for developing new online tools and evaluation once, in which case guiding pupils
and apps for tablets or smartphones. through the waterfall process may make most
sense. Other times, it would be worth taking a
The emphasis in agile methods on individuals and more iterative approach, getting pupils to look
interactions, collaborating with customers and for ways in which they could add further features
responsiveness to change might put us in mind to their programs, improve the user interface
of the ‘child-centred education’ pedagogies of an or refine their algorithms, as well as emphasising
earlier generation, but perhaps even today there’s repeated coding, testing, debugging as part of the
scope in some computing lessons for supporting programming process itself.
and encouraging pupils as they pursue individual,
independent projects or their own lines of Pupils who find that they really enjoy coding
investigative enquiry. and choose to do this independently outside of
formal lessons might often adopt an approach with
So which approach should we use in class? much in common with agile methods – there is
anecdotal evidence that this is often the case for
One of the aims of the programme of study is that
those contributing to the Scratch community or
pupils:
pursuing their own project ideas on the Raspberry
can analyse problems in computational Pi.You might like to look for ways to facilitate
terms, and have repeated practical this approach in curriculum time too: perhaps
experience of writing computer programs setting very open challenges to pupils, for example
in order to solve such problems ‘make an educational game’, providing support and
challenge as needed as well as encouraging pupils
At Key Stage 2, pupils should already have had some to help support one another as they rise to meet
experience of working on larger software projects the challenge. There is anecdotal evidence that girls
than just learning the key programming concepts of seem to find programming projects where there’s
sequence, selection and repetition: a clear purpose and scope for creativity more
engaging than relatively closed, abstract coding
design, write and debug programs that challenges such as ‘implement bubble sort’.
accomplish specific goals
CONTENTS 38
»
Computational Thinking
CS Field Guide (n.d.) Software engineering. Available Aristotle (350 BCE, translated by Smith, R. 1989)
from http://csfieldguide.org.nz/en/chapters/ Prior analytics. Indianapolis, IN: Hackett.
software-engineering.html
Berlekamp, E.R., Conway, J.H. and Guy, R.K. (2004)
DevArt: Art Made with Code (n.d.) Available from Winning ways for your mathematical plays (volume
https://devart.withgoogle.com/ 4, 2nd edition). Boca Raton, FL: Taylor and Francis
Group.
Dweck, C. (2012) Mindset: How you can fulfil your
potential. London: Hachette. Bjork, E.L. and Bjork, R.A. (2011) Making things hard
on yourself, but in a good way: Creating desirable
Harel, I. and Papert, S. (1991) Constructionism. New difficulties to enhance learning. In: Psychology and the
York, NY: Ablex Publishing Corporation. real world: Essays illustrating fundamental contributions
to society. 56–64.
Education Endowment Foundation (n.d.)
Teaching and learning toolkit. Available from http:// Boole, G. (2003) [1854] An investigation of the laws of
educationendowmentfoundation.org.uk/toolkit/ thought. Amherst, NY: Prometheus Books.
Kafai,Y. and Burke, Q. (2014) Connected code:Why Brennan, K. and Resnick, M., 2012, April.
children need to learn programming. Boston, MA: MIT New frameworks for studying and assessing
Press. the development of computational thinking.
In Proceedings of the 2012 annual meeting of the
Peha, S. (2011) Agile schools: How technology saves American Educational Research Association,Vancouver,
education (just not the way we thought it would). Canada (pp. 1-25).
InfoQ. Available from www.infoq.com/articles/agile-
schools-education Brin, S. and Page, L. (1998) The anatomy of a large-
scale hypertextual web search engine. Computer
Philbin, C.A. (2015) Adventures in Raspberry Pi. Networks and ISDN Systems 30:1-7. 107–117.
Hoboken, NJ: John Wiley & Sons.
Christian, B. and Griffiths, T. (2016) Algorithms to live
by:The computer science of human decisions. London:
William Collins.
CONTENTS 39
»
Computational Thinking
Dean, J. and Ghemawat, S., 2008. MapReduce: Rajlich,V. and Wilde, N. (2002) The Role of
simplified data processing on large Concepts in Program Comprehension. In:
clusters. Communications of the ACM, 51(1), pp.107- Proceedings of the 10th International Workshop on
113. Program Comprehension. 271–278.
DfE (2013) National curriculum in England: Russell, B. (1946) A history of western philosophy.
Computing programmes of study. London: DfE Crows Nest, NSW: George Allen and Unwin.
Dweck, C.S. (2006) Mindset. New York: Random Sorva, J. (2013) Notional machines and introductory
House. programming education. ACM Transactions on
Computing Education 13 (2). 8:1-8:31
Gamma, E., Helm, R., Johnson, R., et al. (1994) Design
patterns: Elements of reusable object-oriented software. Williams, L.A. and Kessler, R.R. (2000) All I really
Boston, MA: Addison Wesley. need to know about pair programming I learned
in kindergarten. Communications of the ACM, 43 (5).
Hoare, C.A.R. (1961) Algorithm 64: Quicksort. 108–114.
Comm. ACM., 4 (7). 321.
Wing, J. (2008) Computational thinking and thinking
Knuth, D.E. (1992) Literate programming. California: about computing. Phil.Trans. R. Soc. A., 366:1881.
Stanford University Center for the Study of 3717–3725.
Language and Information.
Wing, J. (2010) Computational thinking:What and
Knuth, D.E. (1997) The art of computer programming why? Available from www.cs.cmu.edu/~CompThink/
(volume 1: Fundamental algorithms). Boston, MA: resources/TheLinkWing.pdf
Addison Wesley
Wirth, N. (1976) Algorithms + data structures =
Laurillard, D. (2012) Teaching as a design science. programs. Upper Saddle River, NJ: Prentice-Hall.
Abingdon: Routledge.
CONTENTS 40
»