The concept of abstraction is fundamentally essential and rooted in human existence. Since 200,000 years, humans have accumulated an immense set of knowledge in many different fields. Doing so has been possible with abstraction, a concept that helps us grow our knowledge in a lot of different ways. We will explore what abstraction is with a philosophy perspective, to help us understand abstraction in computer science and the human brain.
One of the most popular reflections of abstraction in philosophy has been made by John Locke in 1689. In book III, Locke mentions that in the language, we use general terms to speak about particulars. The reason is that there are too many particulars to think about, and it would be an overwhelming task for the mind to remember all the specifics. Therefore, we use general terms as words that classify specific things under a group. This classification is made possible with abstraction.
For example, the word “horse” encompasses anything that resembles a horse in your perception. All these particular elements in the group are linked by the essence that makes each element part of the group. And this essence is the result of the abstract ideas that you have of horses. Abstraction forms the essence in the mind and creates knowledge as a whole.
Now, what is clearly an abstraction? The roots of the words define something abstracted as “something pulled or drawn away”. This is exactly the process that the mind engages in when grouping ideas as mentioned above. It converts the real element to a mental appearance (or idea) and detaches the latter from any real-life features as space or time.
So there is the process:
- Mind identifies a real thing
- Converts it to idea
- Detaches from real life
- Observe the essence of the element
- Group the element under a general idea = an abstract idea.
Now let’s identify abstraction in Computer Science, a human created field, and see how this process of abstraction can be reflected in this field.
A computer contains a CPU, the brain of the computer. The CPU receives electric current through its architecture. The wiring inside the CPU will interpret an electric current as a 1 and an absence of electric current as a 0. These sets of 1s and 0s are instructions sent from the RAM to the CPU, telling it to execute certain things. Then, when the CPU knows what to do, it will process instructions again as electric current to other components on the motherboard.
To execute such tasks, the CPU needs to perform computations under the form of calculations. These calculations are made possible with logic gates. Logic gates are electronic components called transistors, that we find on the electric board. A logic gate accepts electric current as input and will output a 0 or a 1. The output depends on the input, and there are different logic gates that will have different logic to output the result.
Let’s take the AND gate. It outputs a 1 only if all the inputs are 1s, otherwise it outputs a 0.
So if we give 1 and 0, the result will be 0.
Now imagine an entire electronic board made of a large amount of these gates, and the possibilities of calculations.
All the things mentioned above are at the physical level, or the lowest level of abstraction possible. This means that we are the closest of reality, as electricity is a natural process of electrons flowing through material. Now let’s increase the level of abstraction from electric current to structured set of instructions.
Where do all these instructions originally come from?
The answer is programs. Computer programs are just a way for humans to send instructions to the CPU. Now we are a level of abstraction higher from the physical level.
In computer programs, there are several levels of abstraction depending on their “distance” from the physical components of the motherboard.
The lowest programming language is the machine language, that contains functions as bits, sent directly to the CPU.
Then, if we increase the level of abstraction, or in other words, detach even more from the reality of electric current, we have assembly language.
Assembly Language contains instructions that are human understandable, to communicate with the CPU. For example, the “MOV” instruction allows assembly languages to tell the CPU to move data into a specific place.
Now let’s move up again to the higher abstraction level and see high-level languages.
High-level languages are programming languages with which programmers can use natural language to write programs that will send instructions to the CPU. In Java, which is a high-level language, you will write System.out.print(“Hello World”); to display on the monitor “Hello World”.
The word “print” directly matches the idea of printing for the programmer, making the language convenient to use.
The language will be translated to assembly language via a compiler, and then the assembly language will give machine code, instructing the CPU.
And above all, are visual languages or even the input from a user. The input will trigger high level language instructions that will trigger the cascade stated before.
All these different levels in the computer language are all linked thanks to abstraction. This process is similar to the abstract ideas that John Locke discussed in the 17th century. Similarly to specific ideas in the mind transformed to general ideas by abstraction, the specific that is the electric current is translated through multiple layers to the level of understanding for humans. The electric current that is real, is seen as a mental appearance, detached from reality, transformed into natural word languages. These natural word languages are programming languages that we use nowadays and that dictates a large part of our societies.