The concept of high-level and low-level programming languages often appears in programming theory books or IT-related blogs. But what is a high-level and low-level programming language?
What is a programming language?
A programming language is a set of methods used to pass instructions to the computer. These instructions first go through a compiler or interpreter that transforms the source code into binary code. But if every programming language does the same thing, why are there so many different languages?
To answer this question, we have to understand that, in programming, there are several ways to do the same thing. To deliver a box to a person, for example, you can deliver the box directly to him, you can send it by post, you can leave it on his desk, among others. Each of these forms has advantages and disadvantages, but they all served their purpose.
The same happens with programming languages, where there are different languages for different needs. Languages are usually divided into high-level languages and low-level languages.
What is the difference between high and low level languages?
This "level" of language is not about better or worse languages, but easier or harder languages for human beings to understand.
High-level languages are languages that resemble human language, being much more readable for human beings. Some examples are Python, Ruby, Perl, PHP and Java.
Low-level languages are typically languages that more closely resemble machine language, such as assembly and C.
One way to see this more clearly is to compare two codes from the famous "Hello World". First in Python:
print('Hello World')
And now in Assembly:
lea si, string
call printf
hlt
string db "Hello World", 0
printf PROC
mov AL, [SI]
cmp AL, 0
je pfend
mov AH, 0Eh
int 10h
inc SI
jmp printf
pfend:
ret
printf ENDP
Let's agree that assembly code looks more Greek than anything else, right? And that's exactly why high-level languages exist: they make the programmer's life easier. Low-level languages are typically faster than high-level languages, precisely because the programmer can pay more attention to specific details of the operating system's architecture.
Which is better: high or low level?
There is no answer to this, higher-level languages are easier to program, while lower-level ones have a number of performance advantages. It all depends on your goals as a developer.
If you want to learn about low-level languages, a good tip is to study C and Assembly. Knowing how to deal with such languages is an extra point on your resume, especially for more advanced positions.
If you prefer the practicality of languages with a more common syntax and with a good performance despite being of a higher level, you will probably prefer something like C++ and Rust.
We also have higher-level languages like Java and C#, both compiled to a bytecode and run by a virtual machine, and PHP, Python, Ruby, JavaScript, and Perl, which are interpreted and higher-level languages than the aforementioned languages .
And so? Did you already know all this? Tell me in the comments ;)