Share this article!

Abstraction is an integral part of computational thinking and problem solving. It is also one of the most difficult parts of computational thinking to conceptualize. Much of this difficulty has to do with the semantics of the word “abstraction,” which is often inferred to mean unclear or vague. However, the more relevant definition of abstraction as it pertains to computer science is “the summary of something” or “the extraction from something.”

Abstraction, as used in computer science, is a simplified expression of a series of tasks or attributes that allow for a more defined, accessible representation of data or systems. In computer programming, abstraction is often considered a means of “hiding” additional details, external processes and internal technicalities to succinctly and efficiently define, replicate and execute a process.

Real-Life Examples of Abstraction

One well-known example of abstraction in the computer science space is illustrated in an article Thorben Janssen at Stackify. In this example, Janssen explains abstraction in terms of making your morning cup of coffee. You can complete the process knowing only to add water and beans and switch the coffee maker on. You don’t necessarily need to know how the coffee maker functions to provide coffee. With the very specific task of “making coffee,” you don’t even need to consider how and when to provide a mug, as that would be considered a separate “task” from “making coffee.”

In this example, abstraction consolidates the function of the coffee maker simply into the process of “turning on the coffee maker” and eliminates the need to think about anything more complicated than the base processes to complete that specific goal: put in filter, add coffee grounds, measure and add water, switch on. Read more about the “CoffeeMachine” abstraction here.

Additionally, some real-world examples of abstraction include:

  • Baking a cake. If you are following a recipe to bake a cake, you are using abstraction. In this example, you’re following only the necessary steps to prepare and bake the batter. You are not calculating or analyzing the science behind different leavening agents and baking temperatures and may not understand the inner workings of the oven’s temperature control and timing mechanisms. However, you can still complete the task of baking a cake since these intricacies are automatically accounted for when you measure the ingredients into a bowl, mix and place the batter-filled pan in the oven for the specified amount of time.
  • Using known color and outfit combinations to dress in the morning. Another real-world example of an abstraction is getting dressed in the morning. You’re able to quickly evaluate wardrobe needs and put together a corresponding outfit relatively simply. Perhaps you have a pants and jacket set that provides a simplified match. You have previous knowledge about which patterns and colors match without reanalyzing color science each time you get dressed, efficiently narrowing down your blouse or shoe selection. Finally, you also use abstraction to effectively pair a sweater and jeans as opposed to a sweater and running shorts instead of analyzing every possible clothing combination every time you get dressed.
  • Driving to work. Driving to work also uses abstraction in the real world. There are intricate workings inside the motor that make your vehicle move (for instance, the starter motor engages the flywheel, which turns the crankshaft, moves the pistons and starts the engine’s combustion process). However, aside from “start engine, engage drive and use gas and brake pedals,” these intricacies are largely ignored when you drive to work. You are also automatically extracting your ideal route from all possible routes, likely with a preferred effective route that you use the majority of the time instead of re-evaluating every turn, or even every route variation, as you approach it.

Another Misconception

A common misconception about abstraction is that it must include steps that obfuscate more complicated parts of a task (such as how a coffee machine works, how an oven works, how a car engine works, etc.). However, this is not necessarily true. In abstraction, the defining factor is not that these processes are not understood by the end user, but rather that they are “contained,” with the purpose of getting the same result with less work. For instance, all the inner workings (or attributes) of a coffee machine are contained in the simplified container, or object, of “coffee machine.” All of the inner workings/attributes still exist, and may even be understood, but are simplified by using “coffee machine” instead of explaining the inner workings/attributes every time a cup of coffee is made.

Final Thoughts

Abstraction is, quite simply, the process of simplifying the representation of code in external systems. This concept is integral in computer science and coding and in computational thinking. Learn more about teaching abstraction and computational thinking to students by exploring EasyTech today.