Discussions 3 - Computational Thinking
3.0. Overview
Computational thinking is a problem-solving process that involves critically analyzing problems and considering strategies for solving them, with special attention given to solutions that might involve using a computer.
Let's see exactly what that means.
3.1. Using Computers
We use computers to get digital things done. Sending email, surfing the Internet, streaming music, sharing updates on Facebook and Instagram. Most of us use a computer of one kind or another (smartphones are computers, too!) on a daily basis.
3.2. Programming Computers
Some people know how to program computers. Writing code to get the computer to do what you want it to do is a skill used by game programmers, website development teams, software engineers, and others who need to have a high degree of control over the computer and how it interacts with data.
Everybody needs to know how to use a computer. Does everybody need to know how to program a computer? Some high schools now require students to take a computer programming course as a graduation requirement, and some schools offer Foreign Language credit for learning a programming language.
Think about it
What do you think about computer programming? Should everyone know how to write a computer program? Why or why not? Give evidence to support your reasoning.
3.3. "Computer Science" vs. "Computer Programming"
There is subtle but important difference between Computer Science and Computer Programming.
Computer Science
Computer Science asks the questions "What can we compute? How best can we compute it?"
Computer Science studies:
- problems and problem solving
- algorithms (step-wise problem-solving strategies)
- computational thinking
Computer science is not the study of computers, although computers are an important tool used by computer scientists: "Computers are to computer science what telescopes are to astronomy." (Edsger Dijkstra)
Computer Programming
Computer Programming involves taking an algorithm and encoding it in a language that can be executed on a computer.
Programming languages like Java and Python provide a syntax for implementing algorithms.
Introductory computer classes like this one typically include both computer science and computer programming topics. If you're curious about the difference between those two ideas, see Computer Science vs. Computer Programming [YouTube] for further explanation and exampls.
Show/hide computer-related topics.
- Computer Science
- Software Engineering
- Computers (hardware)
- Languages
- Uses of computers
- Programs (software)
- The Internet
- Operating Systems
3.4. Computational Thinking
Somewhere between using computers and programming computers is the subject of computational thinking.
Definition: Computational Thinking
Computational thinking is a problem-solving process that involves critically analyzing problems and considering strategies for solving them, with special attention given to solutions that might involve using a computer.
You don't need to know how to program a computer to do computational thinking. But you do need to be able to look at a problem and observe it, notice patterns, and think critically. Analyzing a problem using computational thinking will produce a solution that can be used to solve that problem and other ones like it.
Think about it
What are the similarities and differences between computer programming and computational thinking?
Similarities: Programming and computational thinking both have to do with figuring out how to solve a problem, and using an algorithm to solve the problem, and a consideration of how computers might help to solve the problem.
Differences: Programming involves actually working on a computer, while Computational Thinking doesn't necessarily require that. Programming involves knowing a programming language that can be used with the computer, while Computational Thinking is more about the process of solving the problem.
3.4.1. Why Study Computational Thinking?
Let's answer that question with a series of similar questions.
Why study English?
Why should we study reading and writing in high school? I'm not going to be a writer!
It's true that many of us have a fairly decent proficiency with the English language by the time we get to high school. However grammar, vocabulary, reading, literary analysis, and writing of all kinds are skills that you will use throughout your life.
There's a reason that you're required to study English for four years in high school. It's one of the most important things that you'll ever learn!
Why study Science?
Why should I study science? I'm not going to be a scientist!
You may not become a professional scientist, but everyone needs to have a solid understanding of the fundamental principles that govern our world. You may not design electronic circuits, but when you walk into a room and turn on the lights, you need to know that you've completed an electrical connection, that the light bulb uses energy, that a circuit breaker protects your house from catching on fire if there's a short circuit, and that the energy you use is related, directly or indirectly, to global climate change.
These ideas are fundamental to you being able to engage in a conversation with other well-educated people.
So why study Computational Thinking?
Not everyone needs to program a computer... but using hardware and software is increasingly a part of most people's lives. When using computers, or engaging with others who use computers, some knowledge of computational thinking is essential for you to be able to participate in that discussion.
Computational Thinking is thought of by many people as "critical thinking with computers in mind." Problem analyses that take into account solutions that are especially efficient, or that may be suitable for adapting to computers, are often more useful than those that don't.
Example of Simple Computational Thinking
I have two different routes I can drive to get from my house to my local gas station, shown here:
Which route—the East route or the West route—is the better one to take, and why?
Solution:
The East route is shorter, but it requires me to take a series of left turns, including from my house (where I have to wait for both of lanes of traffic to clear), at each intersection (where I have to wait some more), and at the gas station as well.
The West route is a bit longer, but allows me to take right turns every step of the way. I only have to wait for one lane of traffic to clear before leaving my house, I can turn right on the red lights, and it's an easy right turn in to the gas station itself.
But the final answer may depend on other factors as well: What time of day is it? How bad is traffic? Is the sun rising or setting, making it hard for me to see when I'm driving in its direction?
We haven't gotten very deep into the idea of Computational Thinking, but something that we'll be seeing soon is the idea of an algorithm.
Definition: Algorithm
An algorithm is a series of systematic steps that can be used to solve a given category of problem.
So what advice would we give to our driver above?
Think About It: The Driving Algorithm
So what's the algorithm for the best route in going from one place to another (based on our example above)? What series of steps would we recommend?
Think about it for a moment before you click on the answer.
Solution:
One answer might be:
- If there's not a lot of traffic, choose the route that travels the shortest distance.
- If there IS a lot of traffic, choose the route that has the most right turns.
The average driver may not think about these things. And maybe a smart driver would think about these things, but only have to worry about it once in awhile.
But every time you use Google Maps, or Apple Maps, or Waze, or any GPS application on your phone or in your car, that program is looking at where you are, and where you want to go, and it's trying to figure out the best way for you to get there, based in part on at least some of these factors.
3.5. Computational Thinking at Scale
If you had to try to repeatedly solve the problem of quickly calculating the best route to a destination and get the answer right most of the time, you'd want to try to find an algorithm that you could code into the program.
And you would arrive at that algorithm using Computational Thinking.
Over the course of these few lessons, we'll be looking at some relatively simple and concrete examples of how Computational Thinking can by used to analyze a problem. These problems are designed to be interesting and manageable, and to illustrate the process of Computational Thinking.
It's important to understand, however, that Computational Thinking skills apply to problems of all scales. A simple question:
may use the same solution that would apply to a larger question that affects thousands or millions of people:
Do Companies Really Do Computational Thinking?
They do.
Some problems will have relatively simple solutions, some of them might be slightly more complex... and some problems that we try to solve have no known solutions (an interesting and frustrating fact).
Computational Thinking is ultimately about trying to wrap your head around a problem to figure out a way to solve it, especially if that solution involves some ordered or systematic process that can be implemented by computers.
Working in Pairs
Very often in here I'll have you working with at least one other person. There are a lot of good reasons for that, but if you're the kind of person who has a hard time working with somebody else (I am!) it takes a little adjusting.
There's some good advice here in this silly but informative video.
3.6. The Elements of Computational Thinking
Now that we know a little bit about Computational Thinking, let's take a look at four elements, or four problem-solving strategies, that we can use in "thinking computationally" about a problem, analyzing the problem and coming up with a solution.
There are a number of different ways of considering Computational Thinking. One useful strategy is to approach a problem with these four aspects in mind.
Four Aspects of Computational Thinking
- Problem Decomposition
Breaking down data, processes, or problems into smaller, more manageable parts - Pattern Recognition
Observing and recognizing patterns or trends in data - Abstraction/Model
Identifying the general rules or principles that are responsible for those patterns or trends - Algorithm Design
Developing instructions or procedures that can be used to solve this problem and others like it
Even if you've never used this particular vocabulary when problem-solving, most of us have occasion to use some of these strategies on a fairly regular basis. By formally recognizing these steps and identifying their use, we put ourselves in a better position to understand Computational Thinking processes.
3.7. Examples of Computational Thinking
EXAMPLE 1. COMPUTATIONAL THINKING ANALYSIS (Abstract)
Take a moment to watch the 5-minute video presentation here. Be sure to pause the video so that you can consider the questions being asked before going on to see the answer.
EXAMPLE 2. COMPUTATIONAL THINKING ANALYSIS (Applied)
Take a moment to watch the 5-minute video presentation here. Be sure to pause the video so that you can consider the questions being asked before going on to see the answer.
EXAMPLE 3. COMPUTATIONAL THINKING ANALYSIS (Applied)
1.c. Shopping for Groceries
Shopping for a list of groceries at the supermarket is a common task, and it can occupy a lot of time. What's the best way to go about shopping for groceries?
Consider the problem in terms of our Computational Thinking steps before looking at the solutions below.
- Problem Decomposition
Breaking down data, processes, or problems into smaller, more manageable parts - Pattern Recognition
Observing and recognizing patterns or trends in data - Abstraction/Model
Identifying the general rules or principles that are responsible for those patterns or trends - Algorithm Design
Developing instructions or procedures that can be used to solve this problem and others like it
Here's one Computational Thinking Analysis:
1. Problem Decomposition
There is a list of items, and those items are located in different parts of the grocery store.
2. Pattern Recognition
I have a random list of items to buy that aren't in any particular order. Items at the store do seem to be organized somewhat: dairy items are all in one area, cheeses are in another, and fruits and vegetables are in their own section. But those sections aren't located in consistent locations from store to store.
3. Abstraction/Model
There isn't much abstraction necessary for this analysis. The grocery list of items can be considered as a List or Array, a data structure that is used all the time in programming. The map of the store is simply an arrangement of locations that need to be visited.
4. Algorithm Design
There are two possible strategies that we might develop for doing our grocery shopping:
- Go down through the shopping list one item at a time, travelling to that part of the supermarket where that item can be found, and getting that item to put in the shopping cart. In this strategy, the list we're consulting is "in order"--we'll be assured of looking at each item on the list--but our visits to the various parts of the store are "disordered."
- Travel up and down the aisles of the supermarket, picking up items from the list as they are encountered. In this strategy, our traversal of the aisles is ordered--we're sure to visit each location in the supermarket--but our use of the grocery list itself is disordered.
1.d. Algorithm Efficiency
Which of these strategies is more efficient? Does the strategy that you choose depend on the length of the shopping list? The size of the store? The number of people you have helping you shop?
Show/hide solutionSearching algorithms don't just apply to things like buying groceries.
This graphic shows some of the different search strategies that might be employed when looking for an avalanche victim.
It's interesting that the Single Searcher pattern in this graphic looks just like my shopping strategy when I have a long list of items. Fortunately, the results of my shopping—finding where they keep the peanut butter—are a lot less critical then the results for rescue personnel.
EXAMPLE 4. COMPUTATIONAL THINKING ANALYSIS (Applied)
1.e. Violence in music: Rap vs Metal
Which type of music is more violent: rap or metal? This is a loaded question, purposefully vague, that we're going to try to solve with a computational thinking approach.
This is a good time to point out that the 1-2-3-4 steps that we've been following might not always be addressed in that order. For instance, in this example, we might being by thinking about our abstraction of the problem first.
3. Abstraction/Model
What does it mean to say that "music is violent?" The question itself is open to some interpretation. Is it the music itself that the questioner thinks might be violent? Is it the lyrics that are violent? The images evoked by the lyrics? Are the artists violent? How does one measure "violence?" For the purposes of this exploration, let's say that we're going to consider the lyrics of the music as a measure of the music's violence. The more violent lyrics there are, the more violent we'll consider the music.
1. Problem Decomposition
In our consideration of how we're going to measure violent music, we've decided to look at the lyrics in a song, or—because we're looking at an entire genre of music—a collection of songs. So all we really need to do is get the lyrics from, say, twenty songs in each genre, and look at the lyrics of those songs.
4. Algorithm Design
We'll get the top twenty songs in each genre of music, and get the lyrics for those songs, and then identify words that are associated with violence: death, war, kill, shoot, gun, etc. We'll count how many times each of those words appear in the songs of each genre, and then come up with an average value per song. The highest average of violent words will be the more violent music.
2. Pattern Recognition
Again, we're a little out of order here because in this case, we'll probably want to look at our results and see if we're getting good information. Are we missing some important "violent words" that we didn't think of when we made our original list? Maybe we should add those to our list and re-run our investigation. Are there violent acts that are described in the music that are not getting picked up by our "violent word" filter? Should we consider adding "curse words" to our analysis? Do those kinds of words indicate some degree of aggression or violence? We'll need to figure out a way to account for these things, or at least acknowledge that our algorithm isn't picking up everything.
In any event we know that our measurement won't be perfect. That shouldn't keep us from doing the analysis, we just need to be honest about reporting our methodology so that other people can see how we arrived at our results.
Show/hide results of this analysis
No results are presented here! Are you disappointed?! ;)
This is the kind of problem that you can easily solve yourself. If you want to analyze lots of songs, or lots of genres, you would almost certainly want to use a computer to assist in that analysis. In fact, some people have done that very thing, to examine patterns in the lyrics of certain types of songs.
Assignment: Lesson 2
To complete this lesson:
- Go to the Bebras Challenge, click the "Start" button, and then take a few moments to solve any two of the problems listed there (A problems are easiest, C problems are most challenging). Attempt to reason a solution to the answer before clicking on your response.
- Once you've arrived at a correct solution for each problem, (however many attempts it takes):
- Arrange your browser window and re-size it so that your problem solution is plainly visible on the left three-fourths of your screen.
- On the right one-fourth of your screen, your Desktop background and/or Desktop files should be plainly visible.
- Take a screenshot of the entire screen, including the browser window where you've been doing your work as well as part of your Desktop background. (This helps to identify your work.)