**Keywords:**Algorithm; Decomposition

**Background**

**What is Computational Thinking?**

So, what is Computational Thinking and what does it entail? Let’s start with what it’s not! Computational Thinking is not programming, nor is it thinking like a computer! For me, Computational Thinking is about solving problems. Miles Berry describes it best in his publication to Primary Schools on the topic of Computational Thinking: “computational thinking is about looking at problems or systems in a way that considers how computers could be used to help solve or model these.”

**What are the characteristics of Computational Thinking?**

There has been much debate about what Computational Thinking entails, however, the general consensus is that it includes, but is not limited to, the following characteristics:

**Decomposition:**The process of breaking tasks down into smaller parts in order to explain a process more clearly.**Pattern Recognition:**The process of looking for patterns or common solutions to common problems and exploiting these to complete tasks in a more efficient and effective way.**Abstraction:**The process of filtering out information that is not necessary to solving the problem.**Algorithm Design:**The process of developing step-by-step instructions to solve a problem. Algorithm design often involves decomposition and pattern recognition to help solve a problem.

**Why teach Computational Thinking?**

Computational Thinking is central, not just to the teaching of Computer Science, but also to every day life! The key elements of Computational thinking lend themselves naturally to other STEM subjects such as Science and Maths but, as many would argue, are also an essential component of 21st Century learning. As Jeannette M. Wing, President’s Professor of Computer Science at Carnegie Mellon University, Pittsburgh succinctly puts it in her article published in Communications of the ACM: “

*Computational thinking is a fundamental skill for everyone, not just for computer scientists. To reading, writing and arithmetic, we should add computational thinking to every child’s analytical ability.”*- See more at: http://teachwithict.weebly.com/computing-blog/strategies-and-resources-to-support-the-teaching-of-computational-thinking

**Using magic tricks to teach computational thinking?**

You may be asking the question: “What do magic tricks have to do with computational thinking?”. The simplest answer is that all magic tricks are based on an algorithm (sequence of step-by-step instructions.) Similar to a recipe or set of directions, if any of the steps are wrong or are not clearly explained, the trick is likely to fail.

In this lesson, students will be taught a simple magic trick (Courtesy of Mark Dorling). Using the magic trick students will explore some of the main principles of Computational Thinking.

**Lesson**

**Starter**

Start the lesson by demonstrating a simple card trick - courtesy of Mark Dorling (Digital School House). The purpose of card trick is to teach pupils about sequencing and modelling a sequence of instructions. See video below:

At the end of the trick, divide the students into small teams and give each team a set of cards. Next, challenge the students to repeat the trick and, once they have solved the trick, produce step-by-step instructions. (Note: Try to encourage the students to write down every step – this is key for the next part). Tip: For those students who find this task difficult, you can let them watch the video again. I also find that doing the trick with all the cards faced up also helps.

As the teams write their step-by-step instructions, circle around the class and attempt to follow their instructions: the key here is to follow the instructions exactly – emphasising any imprecise/vague instructions (as if you were a robot). For example, if a student writes down the instruction “Sort the cards into four suits”, do this for every card in the pack - not just the cards 7, 8, 9 and 10, or if a student writes down the instruction “Put the cards in order”, sort some of the cards in descending order 10, 9, 8, 7 and some in ascending order 7, 8, 9, 10. The purpose of this is will become clearer later.

After about 10 minutes, or once the majority of students have completed their step-by-step instructions (whichever comes sooner), stop the class and ask if any of the teams think they have a fully working / close to working set of instructions – if no one volunteers, choose a team you know has completed the task. Next, in front of the whole class, follow the step-by-step instructions from the volunteer group (or group you chose if no volunteers).

**When following the students’ instructions, make sure that you, again, emphasise any imprecise/vague instructions. Hopefully this will generate discussion about need for detailed / precise instructions. Draw out answers such as “The instructions were too vague” or “The instructions were not specific”. Explain to students that computers (such as robots) can’t think for themselves therefore, when programming a computer, they must make sure that their instructions are clear / concise.**

*Important!**Alternatives*

There are several alternatives to this task. Which one choose depends on the amount of time you have and the age/ability of your class. I will suggest some alternatives at end of this post.

**Task 1: Making the Tea**

Explain to students that they are going to write an algorithm for making a cup of tea.

making_the_tea_print.docx |

making_the_tea_solution.docx |

making_the_tea_task.docx |

Once the majority of students have finished, stop the class and ask them “What is wrong with the making the tea task?” Prompt the students to think about the problems that occurred in the previous exercise (Magic trick). Draw out answers such as: “Missing instructions e.g. to fill the kettle with water”, “Need to add instructions for taking things from the cupboard” etc.

Explain to students that we can break down some of instructions, such as filling the kettle, into smaller parts and that we call this “Decomposition”. Explain to students that “Decomposition” is the first step of computational thinking. By decomposing something, we get a greater understanding of the problem.

*Alternatives*

Again, as with the previous exercise, there are several alternatives to this task. I will explore some of these alternatives at end of this post.

**Main activity 2: Writing an algorithm,**

Introduce students to algorithms. Explain that once a problem has been decomposed, the next step is to write a series of step-by-step instructions to solve the problem (otherwise known as an algorithm)

Explain that we can use algorithms to describe everyday routines / activities such as a recipe for making a pizza or set of directions for finding our way home.

Challenge students to write an algorithm (sequence of step-by-step instructions) for a daily routine e.g. getting up in the morning, cleaning teeth, making a sandwich, walking to school, feeding the dog etc. Encourage students to be clear and concise when writing their instructions and not to miss any steps out – no matter how obvious they may appear!

**Plenary**

Write the following keywords on the board:

- Algorithm
- Decomposition

Ask the students to explain the meaning of the two keywords. The

*and*

**Pose, Pause, Pounce***strategy is perfect for this kind of activity.*

**Bounce***Example:*

*a question to the whole class e.g. What is meant by the word Algorithm?*

**Pose***to give students time to digest the question and think of their answer. If the students are engaged, try holding the pause for a little while longer to build up the tension.*

**Pause**

**Pounce:****Quickly, select a student to answer the question. i.e. Insist the answer to the question comes from student A and possibly student B, directly and fast! Obviously, plan in your mind who you are going to direct the questions to before hand.**

*the question or student's response on to another student (immediately after the pounce). e.g. Ask them if they agree with the students previous answer or to give an example.*

**Bounce**For more information about the Pose, Pause, Pounce and Bounce technique, visit: @teachertoolkit - http://teachertoolkit.me/2013/01/04/pppb-version2/

**Homework**

Students to finish off their algorithm or write a new algorithm for different daily routine.

**Next steps:**

- Introduce some simple coding activities using Scratch, Kodu, TouchDevelop, Python Turtle Library etc.
- Introduce students to flowcharts or pseudo code

**Alternative activities**

**Alternatives to starter activity**

*Jam Sandwich Robot*

In this exercise, pupils are asked to create an algorithm from set commands to program their teacher (sandwich bot) to make a jam sandwich. Pupils must write a set of working instructions, using commands such as Pick Up and Put Down, which their teacher has to follow precisely in order to make a jam sandwich.**Tip:**If you're not a big fan of mess, I suggest replacing the jam with something less messy such as cheese or ham however, it’s nowhere near as much fun! To find out more, check out this lesson plan, courtesy of Phil Bagge, CAS Primary Master Teacher (@baggiepr): Jam Sandwich Algorithm (programming teacher bot) Video: https://www.youtube.com/watch?v=leBEFaVHllE

*The robot game*

Ask for volunteer (Inform them that they will be blindfolded!) Tell the volunteer that they are going to act as the “the robot”. Next, ask someone to secretly position an object (e.g. pen or sweet etc.) somewhere around the room.Don’t make it too difficult or dangerous! Once the object has been placed, ask for another volunteer. Inform the second volunteer that they are going to program the robot, using only the given commands to guide the robot to the object, as efficiently as possible! Commands: Forward x spaces, back x spaces, left turn, right turn.*Tip:*

**Alternatives to making the Tea Activity**

*More Flow Chart activities*- Here are a set of Flowchart tasks for simple activities (making tea, coffee, pizza, lasagna etc.) courtesy of David Barnard (via CAS). Includes a differentiated version of the making tea exercise. (Requires you to login to the CAS community - FREE)

**Useful Links:**

- CS4Fun – The Magic of Computer Science - More magic tricks courtesy of Paul Curzon
- Jam Sandwich Algorithm (programming teacher bot) – Jam Sandwich instructions Courtesy Phil Bagge

**Tags:**Computational thinking, magic tricks, algorithms, decomposition

**You may also be interested in:**Strategies and resources to support the teaching of Computational Thinking