Despite being such an important part of programming fundamentals, many programmers and computer science students know very little about High and Low Level languages. If you ask any of them to describe the difference, you’ll likely see a response like the one below.
“High Level languages use English like words and are easier to understand”
That’s technically correct by the way. The main difference between the two really is the fact that High Level Languages use English like words instead of 1’s and 0’s to make things easier for programmers. But is that all there is to it?
Why does anyone use Low level languages if we have High Level languages? Where are Low Level Languages even used? What is the cost of using English like words in High Level languages? Is <insert language here> here a Low level Language or not?
We’ll discuss all these questions and misconceptions in the examples below.
The common definition “High Level Languages use English like words……” is a very general definition that even a non-programmer could give you. As programmers (or related fields) however, you should be aware of the technical definition and difference between the two. Otherwise, what’s the difference between the programmers and non-programmers? The correct definition for both is as follows.
A high-level programming language is a programming language with strong abstraction from the details of the computer (machine language). Likewise, a Low level language has little or no abstraction from the computers logic.
So what is abstraction? You’ll see abstraction used often in different computer terminology if you google it, (especially object oriented programming), but in this case it refers to how detached or separated a language is from the core computer concepts and language. The stronger the abstraction in a language, the “Higher” the language is. (Remember this point for later on in the Article).
Abstraction in High Level Languages
High Level languages do not deal with low level concepts like memory management, registers, stacks etc, instead focusing on variables, arrays, loops, objects, data structures etc. High level languages focus on creating generalized environments and standardizing common tasks. This is contrast to Low level languages where code is written optimized for system specific architecture.
This where the concept of the Abstraction Penalty comes in. It is penalty that languages with any degree of abstraction pay in terms of speed, efficiency and resources. The stronger the abstraction level, the greater the penalty. Low level languages do not have worry about things such as Run-time interpretation or intermediate code which results in extra resources being consumed.
Finally to wrap this concept up we’ll use two diagrams. The diagrams will show the steps each language takes when being executed.
High level languages first need to translated into machine language so that the computer can understand it, only then can be executed it.
However, Low level languages can skip out on this step since they are already in a format acceptable by the computer. (Assembly language has a slight abstraction level, but it’s negligible compared to high level languages) This allows them to execute faster than their high abstraction counter parts.
Low Level Languages
Low-level languages deal with a computer’s hardware components and constraints. Low-level languages directly operate and handle a computer’s entire hardware and instructions set architecture. Programs and applications written in low-level language do not need to be interpreted, and are directly executed on the computer hardware.
Low level languages are used in places where performance, speed and efficiency are critical elements to the success of the program. It’s not important to write the entire program in Machine code or Assembly either. If there’s only a certain part of the program where speed is required, one may only write that part in Machine code and the rest in a High level language of his choosing.
Low level languages were used most often in the old days when there were no other options. It was difficult to code in Low level languages due to the constant need to look things up in a dictionary. Nowadays, very few people still practice low level languages.
An example of low level language use is Operating systems. All major operating systems you see today like Windows and Linux use either C or C++. Now while these aren’t exactly 100% Low level languages, they still have a low abstraction level, while also being fairly readable. It’s a good compromise between the speed required for operating systems while also maintaining readability.
Now we’ll be finalizing the abstraction concept. Most programmers simply separate programming languages into two categories, High or Low. Most people don’t understand that there are different degrees of abstraction, which is where the misconception of C and C++ being low level languages comes from.
Hence this is something we’ve dubbed the Abstraction spectrum, and we’ll be attempting to explain this through the help of a diagram.
In the diagram above, we’ve attempted to create a rough approximation of the different abstraction levels in programming languages. You have Machine Code right at the bottom with an abstraction of zero, and then you have Assembly languages right above it with a really low abstraction level.
Then we have C++, somewhere in between High and Low. Finally we have Java and Python, with Python being a little higher due to it’s higher than usual abstraction. The point of this was to show that you can’t create two categories and sort out languages amongst them. Rather it’s to try and help you broaden your understanding and see it as a spectrum instead.
If you’ve understood this, then great. This was the main point of the whole article. Next time you hear someone debating whether xxx language is high or low level, you know what to say.
Should I learn a Low Level Language?
So after all the benefits of Low level languages, should you learn Machine code or Assembly language? No. Low level languages are becoming more and more scarce as time passes and that isn’t about to change anytime soon. While learning machine code would have some great benefits, the time and skill required is not worth it.
If you’re concerned about performance and memory usage, I instead recommend you learn C or C++. You’ll also learn concepts such as dealing with registers, pointers and memory management allowing you to boost your performance.
This marks the end of the High and Low Level Languages article. Any suggestions or contributions for CodersLegacy are more than welcome. Any questions can be directed to the comments section below.
Looking for the ideal programming language to learn? See our guide on picking the right language.