Levels of programming languages: a brief overview
I will talk about why programming languages are divided into levels, what these levels mean and at what level it is worth starting learning.
A programming language is a set of instructions with which you can send instructions to the processor and thereby control your computer. There are many languages with their own specific syntax, and all of them allow you to make changes to the data stored on the computer, change the content displayed on the screen, run applications, perform calculations, etc.
Different programming languages at different levels interact with a computer, because the machine does not understand English (or any other human language), and a special system of zeros and ones is used to interact with it. But the development of technology has led to the creation of new languages and their division into levels.
As I mentioned above, the computer does not know how to speak English. Communication with the machine takes place with the help of zeros and ones. We literally apply current to certain transistors to turn current pulses into words, images on a computer screen, complex programs and video games. This is the most efficient way to interact with the processor from the point of view of performance, because using a binary system, you transmit commands directly: manage memory, move data, etc.
But there are low-level languages that slightly simplify the process of communicating with the hardware by converting frequently used commands from 1011 into more digestible directives like MOV, AAD.
Such languages are strictly optimized for specific chips and work only on those architectures for which they were originally developed.
It is the only language that a computer understands without any preprocessing. Nowadays programmers do not use it because it is too difficult to understand. There are many more understandable alternatives that perform the same functions, while the machine language is very complex, requires much more time and care from a specialist and does not help in any way in creating new programs, but only complicates this task.
Machine language is information in its pure form, often representing a set of numbers in a binary system (sometimes decimal and other variants are used). Developers must write each command using predefined requests, strictly following the rules for writing instructions for a particular chip with which the programmer works.
The written machine code is passed directly to the program loader, usually ignoring any middleware layers.
This is the first level of abstraction from machine language. The first add-on that simplifies the perception of program code and helps developers write more stable applications with little or no performance loss.
The syntax of the assembly language does not consist of zeros and ones (and not even of numbers with alphabetic values, as in the decimal system), but of quite readable directives that are similar to abbreviated English words. For example, MOV instead of 1011 is responsible for moving data from one register to another.
Each assembly language comes with its own translator, which turns directives in English into directives that a computer can read, that is, machine code. This translator is called assembler. And this is one of the reasons why software written using assembly language is slower - the computer takes time to translate.
The level of abstraction of assembly language is rather mediocre, because the information that the developer manipulates is stored in processor registers (special cells where a certain amount of data can be stored), which forms a close relationship between the written code and the hardware used. Without spending a lot of time, it will not be possible to relay this code to another platform or operating system.
Unlike machine language, assembly language is used even in modern development. In particular, for creating software that requires very high performance, low-level system components or drivers for the hardware of devices.
A Brief Comparison of Assembly and Machine Language
|Machine code||Assembly language|
|Zero abstraction level. Full contact with the computer hardware||The first level of abstraction. There is a layer in the form of an assembler translator|
|It is difficult to understand what is written in the code||The code is more like a human language|
|No additional tools required to run||Requires an assembler to turn code into machine language|
|Syntax consists of zeros and ones||Syntax consists of English words|
Machine code is hard to read, and this poses two big problems in development:
- To learn how to program, you need to spend a lot of time studying the different directives and understanding how they interact with each other and with the physical components of your computer.
- The syntax of machine code is so tricky that it is almost impossible to write programs without making mistakes. You need to be extremely careful.
In this regard, engineers began to create additional levels of abstractions for the machine language, so that people could perform the same operations, but manipulating structures that were much more understandable to them, cutting off some of the tasks previously assigned to the programmer and transferring them to specialized computer utilities.
High-level languages are much closer to English than assembly language and machine code. Therefore, it is easier to perceive, and new generations of programmers began to grow much faster due to the use of simpler constructs in the code.
Features of high-level languages
The code written in a high-level language is subsequently transformed into machine code using special utilities: compilers and interpreters. The first transforms the program into one that is understandable for the computer even before it starts, and the second does it gradually - line by line.
This approach allowed the creation of many unique syntaxes and add-ons. Each option allows you to perform its tasks in different ways, interacting with the hardware.
Interacting with high-level languages, the programmer switches to the management of abstract structures. Registers, memory addresses and requests on the stack (this is a list of commands, to put it as primitively as possible) are replaced by objects, data arrays, variables, boolean expressions, functions, loops and other entities familiar to modern developers.
Pieces of code are more like application and "tactile" elements, which are easier to fit the logic of complex modern applications and websites.
Advantages of high-level languages
- The main advantage is abstraction. Modern developers are not required to know how a computer works and how to communicate with it using zeros and ones. They can create advanced applications without deep knowledge of computer science.
- In addition to the low threshold of entry, high-level languages provide a richer arsenal of tools. Among them are special modules for automatically detecting errors in the code and combining several types of technologies into one working environment (several frameworks, bundlers like Webpack, etc.).
- The software has become portable. One codebase can be used across multiple platforms at once. Powerful interpreters in a semi-automatic mode turn code in one language into code for several operating systems that differ from each other.
Disadvantages of high-level languages
- Poor performance. The higher the level of abstraction, the more time and computer resources are spent on "translating" one language into another. Therefore, some applications, even if they are not very functional, take a long time to load or work unstable.
- Not very smart programmers. Many developers do not go deep into the theoretical base and remain at the level of their language, which greatly limits their horizons and does not allow them to grow from a professional point of view. Attention is dulled, search skills and engineering thinking suffer.
- Excessive focus on tools. The number of additional layers of abstraction becomes redundant. New frameworks, code editors, additional helper applications, languages, standards, etc. appear regularly. The focus often shifts from building good programs to brute-forcing utilities and arguing over which one works best.
Popular high-level programming languages
There are already quite a few of them:
- C is a general-purpose language that underlies dozens of other languages.
- C++ is an extended version of C. It is still held in high esteem and is used in the development of complex applications, such as music plugins and code editors.
- Java is a multi-profile language that allows you to run once written code on dozens of devices and systems.
- Python is an easy-to-learn general-purpose language with neat syntax and many extensions.
- jаvascript is a scripting language that has grown from an exclusive web technology into a powerful language for building applications, games, IDEs, even other languages.
Naturally, there are dozens of times more languages, but there is not enough space for all in this article. If interested, read the Wikipedia article for a list of all known programming languages.
High level degree
The relativity of the term "high-level" arose in connection with the excessive growth in the number of programming languages. Moreover, many of them were based on each other and by leaps and bounds raised the level of abstraction.
Some languages are considered lower-level than others, even in the high-level space. For example, C++ interacts more closely with hardware, and therefore is often referred to as a low-level language, although it is not.
This is because languages like jаvascript have emerged that further alienate programmers from hardware components and create a greenhouse environment in which development is less and less like a hardcore fight with a machine 30 years ago.
Also, low-level languages began to be called languages in which, by default, additional tools were not built to facilitate the process of creating software, for example, "garbage collectors".
Brief comparison of high-level and low-level languages
|Low level language
|The most understandable language for a computer with a syntax of zeros and ones or simple commands for interacting directly with the hardware of the computer||The most understandable language for a person. More like English|
|Allows you to create more productive code.||Generates code that takes more resources and time to run|
|Even when using assembly language, translation occurs once by the assembler itself.||Requires a compiler or interpreter to convert human-readable code to machine code|
|Generates code that runs on a specific device||Creates portable code that can be run across devices|
|Effective in terms of memory usage||Less efficient in terms of memory usage|
|Troubleshooting is time consuming||There are tools for quick automatic error catching|
What to learn and why?
If you are just starting your journey in the development world, then you should not immediately rush into assembly languages and even more so machine code is not worth it. Programming is a complex topic and it is best to start with a certain level of abstraction. At least C++, but Python is much better suited. The latter will help you understand basic concepts and learn the simplest algorithms. And then you will have two ways:
- Choose one of the high-level languages depending on what kind of software you want to create and for what operating systems.
- Start an in-depth study of low-level languages in order to create drivers and firmware for chips in the future.
Instead of a conclusion
Although low-level and high-level languages are different, they get along well in the modern world, performing the tasks assigned specifically to them. By increasing the level of abstraction, the entire modern digital world was created, so it is ridiculous to reproach developers for using only conditional Objective-C and ignoring machine code. But it's also foolish to deny the importance of learning the basics altogether. To be a good person, you need to maintain a balance and learn programming from all sides.