One of the types of thought that humans developed 100,000 years ago, is still useful in the modern days. Probably one of its most proficient uses lies within computer science itself.

According to wikipedia:

In software engineering and computer science, abstraction is:

the process of removing physical, spatial, or temporal details[2] or attributes in the study of objects or systems in order to more closely attend to other details of interest[3]; it is also very similar in nature to the process of generalization;

the abstract concept-objects which are created by keeping common features or attributes to various concrete objects or systems of study[3] — the result of the process of abstraction.

Abstraction is a very important property. Without it we wouldn’t be able to concentrate in solving a programming problem. We would have to write code with lot of specificity useless to the scope of the problem and distracting.

Computers, operating systems, programming languages have abstraction in their essence. Think about it, let’s say you write a program in Java for some kind of machine. You compile it and pass it to javac which compiles it to JVM bytecode. Then the JVM interprets it to run on your operating system (and other ones too).

Each time you go down a level of abstraction, the specificity of the statements and expressions you use increases.

Mathematics is also full of abstraction. In fact, the first mathematical operation we learn as toddlers, is counting (1, 2, 3, …, 8). Then we learn to sum numbers, which is an operation built on top of counting (2 + 2 + 2 + 2). So we learn to multiply numbers, which is built on top of the sum (2 * 4). Then we learn exponentials, which is built on top of the multiplication (23), and so on.

Real-life example

Let’s say you have the following java code:

public class Main {
    public static void main(String [] args) {
        int i = 0;

When you compile it with javac, the resulting output file, will roughly be:

public class Main {
  public Main();
       0: aload_0
       1: invokespecial #1                  // Method java/lang/Object."<init>":()V
       4: return

  public static void main(java.lang.String[]);
       0: iconst_0
       1: istore_1
       2: iinc          1, 1
       5: return

Do you see it? The simple expression we gave (i++) is very high-level, when we go down a level of abstraction, its specificity increases. We can see, in lines 0 and 1, it loads ‘0’ to the stack, stores it into the first variable. Then, the interpreter increments it by one. The map function itself, which we saw in this article, is an abstraction, that relies on iteration

Each time you go up a level, the specificity decreases, and, a higher-level operation allows you to solve other problems. Let’s say that you have the basic operations: sum and difference. With the sum, you can build a multiplication function, with the difference you can build a division function. You can then create an ‘average’ function, as a combination of sum and division. A ‘weightedAverage’ function, as a combination of sum, multiplication and division.

As you can see, the original sum and difference operations are useful in other different contexts.

The next step

You can start to see that, there is a number of things that are abstractions of underlying concepts and operations. Certainly computer scientists are not the only ones that use it.

So, maybe you can start to use abstraction to your own favour, simplify your solutions, even outside of computer science.

What do you think? Discuss in the group