# Module Two: Computational Thinking and How to Teach It

## Computational Thinking

Teaching students to code is about more than preparing them to create computer software. Not every student will become a software developer, and some may enter careers where they don't do much with technology at all. Even within the technology sector, there are plenty of jobs that don't require any coding knowledge!

Nevertheless, learning the logic and methodologies of computational thinking will be of great benefit to every student because these skills are key for helping our students to become seasoned, empowered problem solvers!

What is Computational Thinking?

The phrase "computational thinking" was coined by computer scientist Jeanette Wing in her 2006 article Computational Thinking (which you can read here). At the most basic level, computational thinking is understanding how to compute answers to problems, whether you are a computer or a human being. It involves asking a lot of questions, learning to understand the factors that shape a problem, identifying the goals for solving the problem, and then using all of the information you gather to find a solution.

While there are many benefits and methods within computational thinking, the most common elements that are used within education are Decomposition, Pattern Recognition or Matching, Abstraction, and Algorithms. Let's take a deeper look at each element!

Decomposition

Decomposition is the process of taking a big problem or project and breaking it down into smaller and smaller pieces until they are manageable enough to begin solving. I frequently introduce this to older students by discussing the process of applying for college, but really, it could apply to any problem that needs to be solved.

Photo by REVOLT on Unsplash

For example, in the Spring, I like to work in my garden. Some of the initial steps I might identify for my garden project include:

• Deciding what I want to grow
• Obtaining plants
• Planting them in the yard
• Taking care of them, etc.

Each of these steps could then be broken up even further. When I'm deciding what I want to grow, some of the questions I might ask myself include things like:

• Do I want to grow flowers, food, or both?
• If I grow food, what sort of food would I like to be able to eat later on in the summer or fall?
• What sort of food plants will grow in my climate region?
• What sort of soil do I have, and which plants will grow well in it?

Deciding where to plant my choices will also depend on the answer to many questions.

• How much light does each plant need to grow well?
• Which side of my home gets the most sun exposure?
• Does the plant need to go in the ground, or can I plant it in a planter?
• Do I have enough room for the plant once it grows to full size?
• Are there plants in that part of my yard already, and if so, will they inhibit the growth of my new plant?

As you can see, asking good questions is one of the main methods of problem decomposition, but you can also work backward from the desired result of your project in order to figure out how to make it happen! In this example, I'll talk about how I might plan for a big event, such as a wedding.

First, I'll think about what I want the event itself to look like. How many people am I thinking of inviting? Do I want the event to take place indoors or outside? Am I planning to have full meals served, or just hors d'oeuvres? The better picture I can put together of what I want my final event to look like, the better!

Once I know what my goals are for the finished product, I can work backward to make each piece a reality!

• Whether I want a full meal or hors d'oeuvres, I will need to find a caterer, who will need to know when the event is, what sort of food I want to serve, and how many people will be there.
• I need to find a venue to hold my event, and they will need to know when the event is and how many people will be there. They will also have a lot of questions about what I want for seating and decorations!
• If I want to hire a band, they will also need to know what date the event is, where the event will be held, and what sort of space they'll be performing in.
• To get my guests to attend, I'll need to send invitations out in advance, which need to include information about what date the event is being held, and where.

After looking at my desired results and what I need to do for each one, I can start to see that certain parts of my planning need to be taken care of before I can get started on others, most importantly, the date! All of my other event components need to know the date before they can give me information about their ability to participate in my event! The venue will also need to be identified soon, because all of my other vendors will also need to know this information.

As you can see, even working backward from my desired result involves asking a lot of questions!

Pattern Recognition

Photo by Hannah Lim on Unsplash

Pattern recognition is a very useful skill that humans use constantly to help us understand the world around us and classify types of things in order to make decisions quickly. For example, many people have a strong reaction to seeing a snake they don't know. Not all (or even most) snakes are actually dangerous to people, but because some snakes can be deadly to humans, we've developed instincts that make us treat any snake we see with abundant caution.

Children get a good grasp of pattern recognition at a very young age! How many children do you know who can recognize a dog they've never seen before as a dog? Even if it's a breed of dog they've never seen, chances are they will still be able to correctly identify the animal as a dog.

When it comes to problem solving, pattern recognition a very useful skill to have. If we look at the examples from the Decomposition section, pattern recognition would be another good tool to have for solving these problems.

For example, if I decide to grow new berry bushes in my garden, and I have grown berry bushes in the past, the information I learned through last summer's growing project will help me make better decisions for this summer's garden and my new plants. After I plan my first event and get a good sense for what sort of information each of my venders will need to plan for my event, I can go into planning my next event with a good idea of what steps I need to take first when I start my plans!

When we learn to spot similarities and patterns in our projects, we'll be in much better shape for reusing all of the information that we learned before to make each successive project easier and more consistent.

Abstraction

When you remove the details from an item or a task that aren't necessary for the problem at hand, you're creating an abstraction. For example, a sewing pattern is a kind of abstraction because the pattern itself does not include specific fabric color, fiber composition, or design. It doesn't have a concrete size, or a color of thread or zipper. It certainly doesn't have the modifications to fit a specific person. The pattern is abstracted exactly so that it can be used by almost anyone to make a specific garment that fits them.

Photo by Miki Fath on Unsplash

We need abstraction to create useful software so that the projects that we build can handle a wide range of similar types of objects and calculations. If I make an expense tracker, for example, I need to tell my application how to add new expenses that I don't have the information for yet. In fact, if my application works, people will need to enter a lot of different expenses, so in order for my code to work reliably, I need to make the instructions abstract enough to accommodate all different kinds of expenses.

Abstraction is one of the reasons we use variables, just like we do in math! If you remember the Pythagorean Theorum, for example, the equation is a² + b² = c². We use a and b to stand in for the lengths of the sides of a right triangle in order to solve for the length of the remaining side. This is an abstracted equation that we can use for any right triangle, no matter it's exact dimensions or size!

Algorithms

You may have heard the term algorithm before during conversations about which content you see in Facebook and other social media applications based on what you've liked and shared in the past. If you're like me, you may have assumed that algorithms were extremely complicated mathematical wizardry that may as well come from the world of Star Trek.

Photo by Bram Van Oost on Unsplash

Some algorithms really are that complex, but in the most basic sense, and algorithm is just a set of steps that is designed to solve a specific problem or achieve a specific result. We follow non-digital algorithms all the time, such as:

• Following recipes
• Following sewing or knitting patterns
• Following driving directions from Google Maps or a GPS system
• Doing the Hokey Pokey or the Electric Slide

In fact, most of the things that you do routinely every day can be written down as an algorithm: brushing your teeth, checking the mail, making your breakfast, etc. The only difference between these algorithms and software algorithms is that software algorithms are written in code, and are incredibly detailed and specific so that a computer can follow them correctly.

Play to Learn: Journey to the Master Code Academy

Computational Thinking, by Jeanette M. Wing

## Unplugged Activities

You don't need to use computers to learn effective computational thinking skills! In fact, some of the best ways to teach these thought processes don't involve computers at all!

Examples of Unplugged Activities

Decomposition

• Have students pick a goal that they're interested in achieving. In order to break down this goal into smaller pieces, have them identify questions they have about how to make it to their new goal. For example, when I was a kid, I wanted to be a Marine Biologiest. Questions I may have come up with in this assignment include:
1. Where do marine biologists work?
2. What do you need to study to be a marine biologist?
3. What are the best schools for marine biology?
4. What kinds of volunteer work prepare you to be a marine biologist?
5. How can I become a dolphin trainer?
• In math, get students into the habit of starting word problems by identifying the information that they already have, and then figuring out which pieces of information they still need in order to solve the problem.
• In writing assignments, have students practice preparing for papers by writing a series of questions about their topics to identify the main points that they want to make in their essays. From here, they can write an outline, which is like a detailed project plan for the writing assignment.

Pattern Recognition

Children start learning pattern recognition as toddlers when they play "One of These Things is Not Like the Others" on Sesame Street. As they get older, there are plenty of ways to practice recognizing new patterns, in all subjects!

• There are thousands of pattern recognition problems online, especially in "IQ Tests", involving patterns, shapes, and number sequences. Here are some examples:
• Make time for pattern recognition across multiple subject areas in discussions with your students:
1. What patterns do they see in ecological nutrient cycles?
2. What patterns do they see when reading different books from a certain genre?
3. What patterns do they notice in music? Do the keys in songs follow predictable patterns? What about the arrangement of choruses and verses?
4. What patterns are there in rhyming poetry? How can you tell what kind of pattern a poem is following based on its meter?

Abstraction

When teaching children about abstraction and why it is important in critical thinking and knowledge development, it often helps to show them both the process of abstraction and the uses for abstracted concepts.

• In math, there are a number of equations (especially in geometry) that can be linked to authentic, practical questions outside the classroom. If we stick with the Pythagorean theory example, you could give students a number of different problems involving the measurement of the sides of right triangles and then discuss how the abstracted equation allows us to use one equation to solve problems that may initially seem very different.
• Code.org suggests using "Mad Glibs" as writing exercises to show students how an abstracted story plan can be developed in to many different kinds of stories.
• In art classes, there are tons of different ways to teach abstraction! You don't necessarily need to prepare second graders to debate the finer points of Magritte's The Treason of Images, but you can talk to them about how we recognize things in images, even if the images contain a lot less detail and precision than what we see in the real world. Much of the animation that we enjoy contains very few details, and yet we readily recognize the objects being represented!

Algorithms

Getting students in the habit of planning out projects and designing algorithms to organize processes may be one of the most valuable skills you can teach them. Learning to approach each problem or project by first considering the entire scope and coming up with a plan can help students across all academic fields, but also through their personal lives as well.

• For younger children, teaching them a plan for each problem or assignment can help them understanding how planning helps make projects and problems easier to solve.
• For older children, discuss projects and problems with them, or invite them to collaborate with their peers to develop a plan of attack for different questions and projects.
• Encourage them to use the problem decomposition questioning methods mentioned above to help develop their plans.
• For longer term projects, students may need guidance in refining their plans, but the efforts they put in working to strategize with their peers will still be very helpful!

Designing Algorithms to Test Understanding

Particularly in math and science, you can use algorithm design problems to help evaluate student understanding of different problems and processes. Because creating algorithms requires students to outline an entire process (such as photosynthesis, for example) from beginning to end, it can help expose gaps or weaknesses in their understanding of how the process works, giving you a chance to correct these misunderstandings together in class. You also may find that algorithm problems help make student understanding evident even for students who have difficulty with the arithmetic that produces the final answer.

For inspiration, read this article describing a lesson plan where AP Biology teachers had students create algorithms to replicate protein synthesis translation and then used their algorithms to create Scratch games: Algorithms, Abstractions, and Iterations: Teaching Computational Thinking Using Protein Synthesis Translation.

Play to Learn: Scratch Game

This is a drag-and-drop game I made in Scratch to help you practice identifying which component of computational thinking is being utilized in different day-to-day activities.

Brainstorming Unplugged Activities

## Digital Activites

When you have the opportunity to link computational thinking exercises with digital literacy practice, you can link all of the different components of both together to help students develop effective problem-solving habits. Later in this course, you'll find plenty of ideas for integrating these coding projects into the other subjects you're already teaching to help support other learning standards and curricular goals.

Examples of Digital Activities

LightBot

LightBot is a game designed to help students learn computational thinking and coding logic. The game itself is only available on mobile devices, and costs a few dollars to download in Google Play or in the App Store, but there is a version called LightBot: Code Hour that is available in a web browser and is free to use. In the game, there is a small robot standing on a game board made up of squares. The goal is to get the robot to special squares and light them up using a set of instruction blocks that control the robot's movements and actions. As the puzzles get more complex, students must go from simple instructions to repeatable sequences (called "procedures" in the game, but comparable to functions - see next module) in order to get the robot where it needs to go!

Hour of Code Activities

While the official Hour of Code activities generally happen in December, the materials to have an Hour of Code in your classroom are available all year, and include dozens of tutorials and lesson plans for different code-related activities for students of all ages. Click here to check out the variety of options on Hour of Code's website! You can even search by subject area, or find tutorials for typed languages rather than block languages, if you're ready to move on from block-coding programs like Scratch.

Building Games in Scratch

Building Scratch projects gives students the opportunity to practice all of the components of computational thinking, especially if you have them plan for their projects before they start building them! Here are some tips for helping students get the most out of their Scratch time:

1. If possible, let students explore a variety of projects made by other people so that they get a chance to see what's possible in Scratch. You may want to pick these projects in advance; letting students use the Explore section of the Scratch web site may make it difficult to keep them on task later, though they are likely to find it even if you don't show it to them!
2. Let students come up with their own ideas for projects to build. This will help keep them motivated as they work on building their projects!
3. Once they have a broad idea for what they want to do, help them to develop their idea into a plan by using program decomposition. You can have students work in pairs or groups and ask each other questions about their projects, such as:
• What kind of projects is it (i.e. story, game, quiz, etc)?
• What sprites and backdrops do they want to use?
• What information should they collect before they start building their project? For example, if they're making a quiz game, what questions and answers are they going to use? Having them write these things out in advance will help to make their projects more smooth as they start to build.
• What sort of experience do they want people to have when they look at the finished project? What do they want the players to learn from their project?
• What will the flow or plot of their project look like?
• What sort of interactions or events will happen during their project?
• Why will people want to watch or play their project? What will make people keep watching or playing after the first minute? (And maybe, what do they enjoy in a project that makes them more likely to watch or play it?)
1. Encourage students to help each other troubleshoot when something doesn't work the way they want to.

In the next module, you'll learn a lot more about Scratch and build your first Scratch project!

Brainstorming Digital Activities