Lesson 0.6: Computational Thinking, Abstraction
Learning Objectives:
Abstraction is one of the cornerstones of Computer Science. It involves filtering out – essentially, ignoring - the characteristics that we don't need in order to concentrate on those that we do. It is also the filtering out of specific details. From this we create a representation (idea) of what we are trying to solve.
Students will learn why abstraction is a cornerstone of computational thinking.
Students will use the idea of a simplified map of their classroom to understand abstraction.
Do Now:
Watch: What is Abstraction?
Explore:
Read: Abstraction
What are specific details or characteristics of abstraction?
In pattern recognition we looked at the problem of having to draw a series of cats. We noted that all cats have general characteristics, which are common to all cats, eg eyes, a tail, fur, a liking for fish and the ability to make meowing sounds. In addition, each cat has specific characteristics, such as black fur, a long tail, green eyes, a love of salmon, and a loud meow. These details are known as specifics.
In order to draw a basic cat, we do need to know that it has a tail, fur and eyes. These characteristics are relevant. We don't need to know what sound a cat makes or that it likes fish. These characteristics are irrelevant and can be filtered out. We do need to know that a cat has a tail, fur and eyes, but we don't need to know what size and color these are. These specifics can be filtered out. From the general characteristics we have (tail, fur, eyes) we can build a basic idea of a cat, i.e. what a cat basically looks like. Once we know what a cat looks like we can describe how to draw a basic cat.
Why is abstraction important?
Abstraction allows us to create a general idea of what the problem is and how to solve it. The process instructs us to remove all specific detail, and any patterns that will not help us solve our problem. This helps us form our idea of the problem. This idea is known as a ‘model’.
If we don’t abstract we may end up with the wrong solution to the problem we are trying to solve. With our cat example, if we didn’t abstract we might think that all cats have long tails and short fur. Having abstracted, we know that although cats have tails and fur, not all tails are long and not all fur is short. In this case, abstraction has helped us to form a clearer model of a cat.
How to abstract
Abstraction is the gathering of the general characteristics we need and the filtering out of the details and characteristics that we do not need.
When baking a cake, there are some general characteristics between cakes. For example:
a cake needs ingredients
each ingredient needs a specified quantity
a cake needs timings
When abstracting, we remove specific details and keep the general relevant patterns.
Creating a model
A model is a general idea of the problem we are trying to solve. For example, a model cat would be any cat. Not a specific cat with a long tail and short fur - the model represents all cats. From our model of cats, we can learn what any cat looks like, using the patterns all cats share.
Similarly, when baking a cake, a model cake wouldn’t be a specific cake, like a sponge cake or a fruit cake. Instead, the model would represent all cakes. From this model we can learn how to bake any cake, using the patterns that apply to all cakes.
Once we have a model of our problem, we can then design an algorithm to solve it.
Activity Part 2
Read: Abstracting Complexity
In computer science, we abstract complexity in many ways, such as computer hardware being seen as components or black boxes. The detail of what goes on inside each component is less important to us.
For example, a computer system can be represented as a simple illustration with no labels, just showing the ‘outside’ of a laptop,this is an abstraction, it is not the real thing:
A simple illustration can represent a computer system.
Or we could draw a simple model of a computer using boxes, a box to represent input devices, a box to represent output devices, a box for the central processor and a box for the memory, what goes on inside each ‘box’ is not considered, just that these components exist and their relationship to each other, this model is an abstraction.
The abstraction above represents a computer. It shows the names of the components and how they interact with each other but hides the complexity of each type of component.
Or we might want to look at very technical information about a computer. A drawing of a circuit board, a part of a computer, is an abstraction, as the detail of how the electrical signals are processed inside the electrical components on the circuit board is hidden.
A technical drawing of part of the raspberry pi showing electrical components and the connections between them.
Image courtesy of Raspberry Pi Foundation (permission requested)
Activity Part 3: Drawing a Simplified Map
Abstracting leads to a simple view of the main idea of a thing. It’s about seeing the wood, rather than the trees, or the leaves, or the cells, or the atoms. For example, a fire evacuation plan only shows you what you need to know to get out of a building in an emergency – it does not include the unnecessary details.
Here's a detailed Map of the San Francisco Municipal Railway.
Here's an simplified of an abstracted map, that only shows the MUNI Metro lines.
Now draw a simplified map of your classroom for a brand new student.
Include the most important items but not all the complex details.
What does that student need to know to use the classroom effectively but not get confused?
Lesson 0.6 Wrap Up:
Reflection:
What is abstraction?
In activity part 3, you drew a map of your classroom.
How could a brand new student use your map to process important information about your classroom?
What are the most important things to include in your classroom map for a new student?
What do they need to know to use the classroom well but not get confused?