5.8 KiB
Abstraction
Abstraction is an important concept in programming, mathematics and other fields of science, philosophy and art, which in simple words can be described as "viewing an issue from a distance", thinking in higher-level concepts, i.e. paying less attention to fine detail so that one can see the bigger picture. In programming for example we distinguish programming languages of high and low level of abstraction, depending on how close they are "to the hardware" (e.g. assembly being low level, JavaScript being high level); in art high abstraction means portraying and capturing things such as ideas, feelings and emotions with shapes that may seem "distant", not resembling anything concrete or familiar. We usually talk about different levels of abstraction, depending on the "distance" we take in vieweing the issue at hand -- this concept may very well be demonstrated on sciences: particle physics researches the world at the lowest level of abstraction, in extreme close-up, for example by examining individual atoms that make up our brains, while biology resides at a higher level of abstraction, viewing the brain at the level of individual cells, and finally psychology shows a very high level of abstraction because it looks at the brain from great distance and just studies its behavior.
In mainstream programming education it is generally taught to "abstract as much as possible" because that's aligned with the capitalist way of technology -- high abstraction is easy to handle for incompetent programming monkeys, it helps preventing them from making damage by employing billions of safety mechanisms, it also perpetuates the cult of never stopping layering of the abstraction sandwich, creating bloat, bullshit jobs, it makes computers slower, constantly outdated and so drives software consumerism. This is extremely wrong. LRS advocates to employ only as little abstraction as needed, so as to support minimalism, i.e. too much abstraction is bad. For example a widely used general purpose programming language should basically only have as much abstraction as to allow portability, it should definitely NOT succumb high abstraction such as object obsessed programming.
In a more detailed view abstraction is not one-dimensional, we may abstract in different directions ("look at the issue from different angles"); for example functional, logic and object paradigms are different ways of abstracting from the low level, each one in different way. So the matter of abstracting is further complicated by trying to choose the right abstraction -- one kind of abstraction may work well for certain kinds of problems (i.e. solving these problems will become simple when applying this abstraction) but badly for other kinds of problems.
Let's take a look at a possible division of a computer to different levels of abstraction, from lowest to highest (keep in mind it's also possible to define the individual levels differently):
- physics: Computer is a collection of atoms and subatomic particles such as electrons, operating with terms such as energy, charge, spin or quantum effects.
- electronic circuit: Computer is an analog circuit in which electricity flows through wires and electronic components, operating with terms such as voltage, current, transistor, resistor or electronic interference.
- logic circuit: Computer is a binary digital circuit; this is abstracting electricity away, now we are only considering two possible values carried by the wires: 1s and 0s. Operating with terms such as logic gate, logic function, multiplexer or sequential circuit.
- machine code/assembly: Computer is a machine with a specific instruction architecture, executing an algorithm encoded as simple binary instructions, such as "add two numbers" or "write a number to memory", in a specific format that's different for different types of computers. Operating with terms such as CPU cycle, opcode, register, memory or interrupt.
- low level portable language: Computer is a machine capable of performing algorithms written in a structured language resembling human language and it's a machine that's essentially the same as other computers, even of different types, i.e. all computers can understand the same language (programs are portable), typically e.g. C. Operating with terms such as structured data type, procedure, signed/unsigned type, memory management etc.
- high level language: Computer is a machine capable of performing algorithms while handling many things (such as memory allocation or ensuring safety) automatically and dynamically (on-the-go) and understanding more complex and abstract descriptions of problems, allowing for very fast and comfortable programming in languages like Python or JavaScript. Operating with terms such as objects, dictionaries, pure functions and polymorphism.
- very high level, artificial intelligence: Computer is a machine capable of simulating human thinking and therefore able to lead a conversation with human, it can perform commands given in natural language and even reason and create on its own. Operating with terms such as training, data sets and ethics.