Lesson 1: What is computational thinking?

Being able to think is one of the hallmarks of being a human being - especially meta thinking which involves thinking about your own thoughts. We often overlook the complexity of thinking because it comes so naturally to us. It seems so easy because we do it everyday with little to no thought about how the process works. It only becomes apparent that it is complex when something or someone interrupts our thought process e.g. try explaining a specific idea you have to someone in one or two sentences; or try follow a lecture in a topic you don’t know anything about. These tasks become difficult because in our daily life we strip away what we can safely assume to make communication easier and more effective. This stripping away of “unnecessary” information becomes a problem when we need it. This is most prominent when working with computer programming because a computer cannot assume any information, so you have to provide commands without exception. This means that you have to adjust your thinking slightly to work through problems in the same way a computer program would. This isn’t as daunting as it sounds because it is quite straightforward and it can also help with the way in which you solve problems outside of programming too.

The main purpose of computational thinking is to identify problems and solve them. This seems simple, but problems themselves can be quite complex and made up of different parts, each of which forms its own separate problem. The complex nature of problems can make them seem to be overwhelming, but when you follow a few simple steps, you are able to break them down into manageable pieces. This is very effective because not only does it work for computational problems, but it also works for most problems you will face in life. There are four key steps in this process:

  1. Decomposition

  2. Pattern recognition

  3. Abstraction

  4. Algorithmic thinking

Using these four components, you will be able to successfully solve problems by “dividing and conquering” them. There are also some additional factors that need to be considered that are not directly related to the core way of solving the problem - constraints. There could be several constraints that you are facing which were unforeseeable, imposed upon your project or factors that weren’t considered when starting. In this course, you will learn to use these four components as well as how to deal with constraints and what you can do to mitigate the effects of them.

Another point that is important to understand involves the following three words: what, why and how. It is always important to understand what you are doing because if you don’t understand that then you cannot reorientate yourself when you face problems in your project. In the same way, you need to understand why you are doing something. Keeping a goal in mind when you break down a problem into smaller pieces will keep you focused on the big picture even when you are working on the smaller issues. This is vital for not losing sight of what your final goal is. Lastly, having a clear understanding of how you are going to do something will put an element of realism to a project and reveal any potential unrealistic expectations right in the beginning. These are three important components to keep in mind when you are working on any step of the computational thinking process. They are supplementary because even though they help keep you on track, you still need the plan and the action to achieve the goal.

This course will teach you how to effectively use these concepts to become a self-sufficient learner and problem-solver. Not only in the computational world, but also in the real world where you are faced with problems that are much less logical and solutions that are suboptimal at best. The principles behind both real world and computational problems are essentially the same, so these lessons are applicable in most - if not all - domains of study and life. The main point you need to keep in mind is that the purpose of the exercises isn’t necessarily to achieve that specific goal, but it’s rather to go through the process so that you learn the formula to achieve any goal.

The four components of computational thinking

1. Decomposition

In simple terms, decomposition is the process of breaking down a large problem into smaller problems. There are a few reasons why this is helpful in the bigger picture. It gives you insight into the practicalities associated with solving the problem. You can view the smaller tasks with more understanding of what needs to be done because the goal is clearer. This can help you develop actionable steps and get started on solving them. Image for a moment you moved to a new house and there is nothing in it yet, but you want to make a cup of coffee after a day of moving. This seems like a simple enough problem to solve - except that it isn’t. You are actually dealing with a complex problem because it’s made up of several problems disguised as one, so the problem actually seems to be impossible. You cannot make coffee because you don’t have any of the ingredients in your house. So there are two main tasks to solve: buy ingredients and make the coffee.

There two tasks can be further broken down into even simpler tasks. When you buy ingredients, you need to do three things:

  1. Make of list of ingredients you need.

  2. Decide where you are going to buy them.

  3. Cecide how you are going to get there.

Instructor note

Make a list of ingredients you need
  • This can further be divided into separate tasks for each item that you need to buy.

  • You will need:
    • milk

    • water

    • coffee powder

    • a kettle

    • a spoon

    • a mug

Decide where you are going to them
  • You can buy all of those items at the supermarket, so you decide to go there.

Decide how you are going to get there
  • The fastest why to the supermarket is by bus, so you decide to take the bus.

  • You also need to make the same trip home after you are done at the supermarket.

2. Pattern recognition

When you have broken the problem down into smaller tasks, you can look for patterns. The first step (the list of ingredients) is made up of several smaller steps even though it looks like one step.

Instructor note

The full step would actually be as follows:
  1. Take the bus to the supermarket

  2. Purchase the milk

  3. Take the bus back home

  4. Repeat the process for all the items

This isn’t an efficient way of doing this, so we can look for patterns in the tasks. The glaringly obvious pattern is that if we buy all the items at once then we only have to make one trip to the supermarket and one trip back home. This is the process of pattern recognition which is very useful in using previous knowledge to apply to new problems. For example, perhaps you are going to a new supermarket because your regular supermarket is closed for the day. You don’t need to go through the entire process of planning everything out because you can use the same pattern as usual, but adjusting a few key points. You would have to take a different bus and walk an extra few meters to get to the new supermarket, but buying the ticket, purchasing the items inside the supermarket and returning home is still the same process. You have recognized a pattern that you can use for other problems which have similar characteristics.

3. Abstraction

The process of abstraction is to discard unnecessary details that are not relevant to solving the problem. You cannot take everything into account when making a decision, so you filter out any unnecessary details and focus on what is relevant to the problem you are solving. In the above example, you take the bus to get to the supermarket. Is it important that you know every stop on the way to the bus stop? No. Is it important that you know the model of the bus you are taking? No. Is it important that you know the bus drivers name? No. These are all factors that could be relevant to someone else if they have a task that involves those details. For example, if you are a bus driver and you need to change shifts with a bus driver named John then it’s important to know the name of the bus driver. So, it’s not necessarily the case that the details are not important, but rather that there are details that are not important to your own task.

4. Algorithmic thinking

When you have decomposed the problem, identified any patterns and filtered out the unnecessary details, you are ready to create a step-by-step guide on how to solve the actual problems. At this point you need to make detailed plans for each step. You have to specify actions in the right order and with sufficient detail, so you can’t just say “take the bus to the supermarket and come back when you’re done”. You need to specify the smaller details such as the time you need to catch the bus, where you need to catch the bus and which number bus you need to catch. Then you need to specify where to get off, which direction to take towards the supermarket and how to long walk from the bus stop. Once you’re in the supermarket, you need to find all the items, collect them in a basket and pay for them. Then you repeat the bus process in reverse order making sure to take the bus from the opposite side of the street.

The relevance of the four components

The importance of the four components is to focus your thinking on the details of the problem, remove any inferences you might have and realistically show what kind of problem you are dealing with. This may seem a bit strange with the first example about coffee. What is important, however, isn’t the example itself, but rather the way in which it was broken down and solved. This forms a blueprint for solving problems and you can use this blueprint to solve other problems. After doing a simple example, you can scale up the complexity of the problems until you are able to this for any problem you face. However, there are other factors to take into account because after all, the world we live in isn’t a static place, so things often change.

A note on the difference between decomposition and algorithmic thinking

While creating a step-by-step plan can be seen as a form of decomposition, it’s important to note that decomposition is a broader concept that encompasses the identification of major components or subproblems. Algorithmic thinking is a more detailed and specific step that involves designing the precise instructions or actions to solve those subproblems. Both steps are crucial in computational thinking as they contribute to breaking down complex problems and devising effective solutions.

You can think of this using the following analogy: if you were to organize a trip overseas then you would break the problem down into a few smaller parts i.e. travel to destination, book into accomodation, organize a few external trips, finish trip and book out, travel back home. This is a broad overview of the solution which is how the decomposition step works. When you are on the algorithmic thinking step, you take each of those smaller parts and create a plan to solve them. Take for example the first part “travel to destination”: decide which mode of transport (boat, car, train or air travel), then decide on the dates and time of departure, etc. At this stage, you should be breaking each part down into very specific and actionable solutions.

Constraints

There are often things that change along the way, so it’s important to understand that most of the time you will have to work within some constraints because you hardly ever have the ideal conditions for carrying out your plan. For example if the supermarket doesn’t have any coffee in stock then what is the solution for that? You could buy tea instead or buy some takeout coffee from the restaurant next door. These aren’t optimal solutions, but they are alternatives due to the constraints that you may face in the real world. What if you find out that the busses have changed their payment systems and now you need to pay with a transit card. The only problem is that you’ve never used a transit card before, so you need to figure out how that works. In this case, the decomposition of your plan is still valid, but you need to adjust the algorithmic thinking portion of the four components. You would need to prioritize getting a bus transit card and loading it with money before going to the bus stop. This would form a new tasks which takes a higher priority to the other tasks since you cannot complete any of the other tasks without first getting the bus transit card.

Something to think about

In your own life think back to a time when you had a problem that seemed overwhelming. How did you manage to solve it at the end of the day?

Using the four components of computational thinking described above, could you have created a better plan to solve that problem that seemed so overwhelming before?