## Want to keep learning?

This content is taken from the Raspberry Pi Foundation & National Centre for Computing Education's online course, Programming Pedagogy in Secondary Schools: Inspiring Computing Teaching. Join the course to learn more.
1.3

# Computational thinking

Before you can use a computer to solve problems, you need to pick those problems apart and decide how to approach them. Computational thinking refers to the ideas and thinking skills used to design solutions to problems, or create systems so that a computer or computational agent can help.

The main areas of computational thinking listed in the Raspberry Pi Foundation framework are:

• Logical reasoning
• Decomposition
• Designing algorithms
• Identifying patterns and generalisation
• Abstraction
• Evaluation
• Organising data

### Logical reasoning

Logical reasoning is a high-level concept that feeds into all aspects of computational thinking. In order to solve a problem, you must be able to think things through logically.

An example of logical reasoning might be when you plan a long journey and need to decide when to leave. You will need to know the arrival time, traffic conditions, journey length, and average speed of the journey. You use logical reasoning to pick the best time to leave.

### Decomposition

Decomposition is a skill used to break a large problem down into smaller, more manageable chunks. Imagine that you have been asked to design a game that asks the player to name a series of shapes. Using decomposition allows you to break this problem down into smaller sub-problems. You need to design the shapes, create the questions, check if the answers are correct, give feedback to the player, and store the scores. These are all steps that can be solved separately and then brought back together to form the solution.

Decomposition can go deeper than a single level. While working on part of the problem, you might feel that further decomposition is required. Always try to decompose a problem further it if feels too complex to solve.

### Designing algorithms

Algorithms are precise sets of instructions that, when executed, lead to a problem being solved. The instructions should be clear, unambiguous, and easy to follow. This means that the algorithm should be so precise that it can be followed by a computer. They can be written for separate sub-problems, or for whole solutions.

### Identifying patterns and generalisation

As you write more programs you will begin to develop a personal library of solutions to common problems. This library can be used for spotting patterns and generalisation.

When you start to notice that you are repeating yourself, you can decide to use a loop instead.

becomes…

You may have already solved a problem in the past that is similar to your current one.

Here is some code to ask for a person’s name and give a response based on a condition.

A similar structure can be used to ask a question in a quiz. Generalisation is when you realise that you can use the exact same pattern, for example each time you want to check for an input and react to it.

### Abstraction

Abstraction means hiding unnecessary details. When finding solutions, you work at appropriate levels of detail. For example, there are many ways to represent a house.

You would use the one that reflects the required level of detail for your solution.

An example of abstraction in programming is when you use a subroutine. For example, a subroutine may have been created that draws a square; if we want to use this code, we simply call the square subroutine. We don’t need to know the code inside, just that it draws a square:

You can use this subroutine without knowing the detail of the steps inside it. The unnecessary detail has been hidden, therefore abstraction has occurred.

### Evaluation

Evaluation is being able to look at your solution periodically and check whether it is working as intended. You should be analysing the success, efficiency, and effectiveness of solutions, comparing them to other solutions, and refining them accordingly.

### Organising data

Being able to structure and organise data is an important skill. You should be able to decide what needs to be stored and how it should be stored, whether that is in a variable, list, array, or tuple.

### Developing computational thinking

As you develop your computational thinking skills, you will become better at solving problems. Through practice, you start to notice when a problem needs decomposing, or you will generalise and remember other similar problems that you have solved in the past that might help. These skills can be explicitly taught to your learners and it is important to give them lots of examples of each skill, to help widen their definition of them.

### Computational thinking in this course

As you learn new pedagogy in this course I will flag up where certain computational thinking skills might be developed.

Which skills have you used before? Which would you like to develop further? Let us know in the comments.

## Get a taste of this course

Find out what this course is like by previewing some of the course steps before you join: