This article is a continuation of the topic of abstraction introduced here. It is important to read it to fully comprehend what will come next.
It is intended to find direct application to computer science. A little background in this discipline could come in really handy; but even if you are not a “tech-oriented” person, you might be able to understand a good portion of this article.
Let’s pick up right where we left off.
We have defined abstraction as the ability to hide the complexity of a “system” by providing an “interface” that eases its manipulation.
The interface provided in front of you leads you to only be concerned about “what it does” instead of “how it does it”.
For this reason, non-tech individuals can use computers, having no understanding of what is going on under the hood.
As a direct advantage of the above, a basic understanding of the abstracted layer is the only prerequisite to operate computers.
In this example, the abstracted layer is the user interface with a mouse pointer, icons, and windows artifacts, while the lower layer is the complex underlying computer architecture.
Application in Computer Science
Well, abstraction in computer science relates to the complexity of the hardware; in fact, every computer comes equipped with CPUs or brains, and each is only able to carry out a limited number of operations or instructions, this is known as the CPU’s instructions set.
This essay is not aimed at describing the instructions found in the CPU (brain) as they vary depending on the model. These instructions are to be considered atomic, unbreakable, and indivisible.
The great challenge in manufacturing sets of instruction lies in an extremely important factor that suggests that:
All present and future problems cannot be known in advance:
Multiple applications can appear to perform the same thing but a careful study reveals that they tend to have specific requirements. It is not possible for CPU manufacturers to foretell all problems that could be faced by users.
And as said before, a finite and known amount of instructions was to be created to solve an infinite and unknown amount of problems.
Hence programming is the ART OF ABSTRACTING atomic level operation to solve Real-World business problems.
But one cannot efficiently abstract at a higher level, operations, or instructions that he doesn’t sufficiently understand…
If the level of abstraction from exponentiation to addition is of three (addition, multiplication then exponentiation), something much more complex is observed in computer operations.
In computer science, the abstraction level goes way above the one observed earlier in exponentiation. A single composite instruction (such as a move file operation described earlier) becomes a composition of thousands if not hundreds of thousands of atomic operations of the CPU’s instructions set.
What you need to know to abstract in Computer Science
From the above, questions that might be burning more than one lips could be:
How much do we need to know about computer hardware and architecture to better leverage low-level instructions in higher-level problems?
Do we even need to know the set of instructions in the CPU to program?
What abstraction layer is availed to us to program computers?
Well, this is where computer programming languages come into play. In fact, it would be totally unbearable to design solutions using computer’s atomic level operation found in its instruction set, the amount of time and effort required to get anything done would be extremely huge; the program will be prone to many errors and the codebase would be of many hundreds of thousands of lines.
We live in a world where the need for computers in every business is crucial, it is totally unacceptable to wait for months to get a simple system finally designed for businesses.
And being a non-exact science, software design tends to build solutions based on user’s requirements, the latter has the reputation of being usually unclear, inconsistent, and sometimes unrealistic.
This has led software development to become a process of constant changes and adjustments. And making changes to a tiny piece of the code could have disastrous consequences on the overall system. hence constant changes are the source of many “bugs” in applications.
A price of flexibility to pay
We do not have to write instructions at their atomic level, there is a solution to this problem that is aimed at ABSTRACTING the commands of the instruction set, CLEVERLY COMBINING them to perform HIGH-LEVEL and ROUTINE operations.
Programming languages are abstractions of commands found in the instruction set, each operation is a composition of many fundamental CPU’s instructions.
Using higher abstraction of CPU’s instruction can come with a price of flexibility to pay; This can lead to performance issues for very specific projects that are demanding in computer resources and closely tied to the CPU’s architecture. Such as operating systems, device drivers, and low-level embedded systems.
By flexibility issue, one needs to understand that we cannot “un-abstract” a high-level language to reuse its atomic component to recreate a different form of higher abstraction.
This comes as a drawback but in a business-oriented world, populated with free-lancers, young entrepreneurs, and many start-ups, the time factor is primordial.
But it’s not every day that a startup will create a brand new operating system or device drivers ;). And in this case, the benefit of abstraction clearly outweighs the cost
What we gain from abstractions
- Abstraction Cuts out the need to understand the CPU’s instruction set
The advantages provided by the above is huge, High-Level programmers can write code without needing to understand how the CPU’s instructions set work. Hence abstraction presents an interface that is concerned with what is done rather than how it is done. This incredibly fastens the software development process and reduces the manpower required.
Keep in mind that even if an understanding of CPU’s instructions is not required for programmers, a clear understanding of the abstraction level of the programming language one uses is crucial to its efficient use;
Not every programming languages have the same abstraction level, hence they are categorized in Low, Intermediate, and High-level languages. This article will not go into the details of this classification.
2. Abstraction reduces the amount of “manual programming”
Having a good understanding of the abstraction provided by the programming language of your choice will help you understand exactly what the language “does for you” implicitly and what you “have to do manually”.
People familiar with programming know for example that garbage collection or memory “deallocation” is taken care of by languages such as Java while C and C++ manually perform this process. You do not have to be familiar with garbage collection to understand the rest of this article.
If you are not a programmer and were still able to follow me this far, know that whenever you operate any program (such as your browser right now), you are abstracting high-level programming language instructions to an even higher level.
Bear in mind that programming languages are abstractions of CPU-level instructions.
There is obviously a huge amount of advantages that abstraction provides. These could not hold together in a single article. The reader could simply derive them from all the paragraphs that implicitly present them.
THE COST OF NOT UNDERSTANDING ABSTRACTION.
Programming is an art consisting of solving problems with available “instruments” such as programming languages. It requires the ability to creatively combine “tools” that have been “sufficiently” understood.
There is an implicit training consisting of constructing “solutions” that abstraction forces one to acquire, it requires us to fully comprehend tools at our disposal before wildly rushing them in production.
A critical thinking and designing phase are imposed by solutions that are to follow principles of abstraction.
Not understanding the principle of abstraction leads to learning specific problems instead of learning how to abstract languages to solve a wider range of problems.
The dangers of learning specific problems reside in the fact that most are completely lost when the set of problems is changed. They cannot have a bird-eye view of programming as the art of solving unpredictability and this can be extremely limiting.
Abstraction enables forecasting; it teaches one to write code that foresees at a certain level refactoring without entirely breaking architecture, it doesn’t always solve the problem with surgical precision but leaves some space for further customization, as human’s requirements tend to change with time.
Software is to adapt with as few difficulties as possible.
Abstraction allows you to learn to approach an infinite set of problems by making clever use of atomic bricks offered by the programming language you use as a tool, hence gives you a set of skills that is portable across multiple set of problems, as well as the ability to produce an adaptable solution to ever-changing requirements.
Thanks for taking the time to read!
Found this article interesting? leave a comment and share it with someone who might find it interesting.