When you’re trying to figure out which programming language to learn, you’re likely to come across the terms “high-level” and “low-level.” People talk about high-level and low-level programming languages all the time.
But what exactly does that mean? And what does it mean for learning to write code? Let’s start with the definitions of each and go from there.
“Higher” and “Lower-Level” Programming Languages
Throughout this article, I’ll talk about “high-” and “low-” level languages. But there’s no specific qualifying criteria for either. Which is why I’ll also talk about “higher” and “lower” levels.
Just keep in mind that it depends largely on your perspective. If you’re a C programmer, Java might seem quite high-level. If you’re used to Ruby, Java might seem like a low-level language.
Machine Code and Low-Level Languages
Whether a language is considered high-level or low-level (or somewhere in the middle) is all about abstraction. Machine code has no abstraction — it contains the individual instructions passed to a computer. And because machines deal only in numbers, they’re represented in binary (though they’re sometimes written in decimal or hexadecimal notation).
Here’s an example of machine code (via Wikipedia):
8B542408 83FA0077 06B80000 0000C383 FA027706 B8010000 00C353BB 01000000 B9010000 008D0419 83FA0376 078BD989 C14AEBF1 5BC3
In machine code, operations need to be specified exactly. For example, if a piece of information needs to be retrieved from memory, the machine code will need to tell the computer where in memory to find it.
Writing directly in machine code is possible, but very difficult.
Low-level programming languages add a bit of abstraction to the machine code. This abstraction hides specific machine code instructions behind declarations that are more human readable. Assembly languages are the lowest-level languages next to machine code.
In machine code, you might write something like “10110000 01100001” — but an assembly language might simplify that to “MOV AL, 61h“. There’s still an almost one-to-one correspondence between what’s written in the assembly language and the instructions passed to the machine.
Moving into more popular programming languages, you’ll come to something like C. While not as low as an assembly language, there’s still a strong correspondence between what’s written in C and the machine code. Most operations written in C can be completed with a small number of machine code instructions.
High-Level Programming Languages
Just like lower-level languages, higher-level ones cover a broad spectrum of abstraction. Some, like Java (which you could argue is actually a mid-level programming language), still give you a lot of control over how the computer manages memory and data.
Others, like Ruby and Python, are very abstract. They give you less access to those lower-level functions, but the syntax is much easier to read and write. You can group things together in classes, which inherit characteristics so you only have to declare them once.
Variables, objects, routines, and loops are all important parts of high-level languages. These and other concepts help you tell the machine to do lots of things with short, concise statements.
Where an assembly language has a nearly one-to-one correspondence between its commands and machine code commands, a higher-level language might be able to send dozens of commands with a single line of code.
It’s important to note that “high-level programming languages” might include everything that’s more abstracted than an assembly language. It depends on who’s discussing the topic. So when you’re talking or reading about languages, make sure you’re on the same page.
Should You Learn a Low- or High-Level Language?
This is sure to be a common question among new and aspiring programmers. Are high- or low-level programming languages better? As is the case with many programming questions, the high-level vs. low-level programming languages question isn’t so straightforward.
Both types of languages have important benefits. Low-level languages, because they require little interpretation by the computer, generally run very fast. And they give programmers a lot of control over data storage, memory, and retrieval.
High-level languages, however, are intuitively easier to grasp, and let programmers write code much more efficiently. These languages are also considered to be “safer,” as there are more safeguards in place that keep coders from issuing poorly written commands that could cause damage. But they don’t give programmers as much control over low-level processes.
Keeping this in mind, here are a selection of popular languages on a scale from low to high:
Of course, this is partly subjective. And it only includes a tiny cross-section of the languages that are available.
But it should give you some idea of where the languages you’re interested in fall on the scale.
What Do You Want to Do?
When deciding what you want to learn, your first question should be what you want to program.
If you’re looking to write operating systems, kernels, or anything that needs to run at the absolute highest speed possible, a lower-level language might be a good choice. Much of Windows, OS X, and Linux are written in C and C-derived languages like C++ and Objective-C.
Consider Learning Both
I recently read a thread about this very question on a programming forum, and came across an interesting suggestion: learn both at once. You’ll gain a deeper understanding of the types of abstractions that make the higher-level language more efficient.
Of course, learning two languages at once isn’t easy, so you might want to stagger them a bit. And choosing two languages that are similar might be helpful as well.
Again, we’ll go back to the point I brought up before: choose a language based on what you want to build. Do some research to find out which languages people in your field are using. Then use that information to pick a high- and a low-level language, and start studying them.
You’ll soon see the parallels and you’ll gain a much deeper understanding of how programming works.
Focus on Goals, Not Means
There are lots of criteria you can use to choose a programming language. High- vs. low-level is one of them. But in almost every case, the criteria you should be using is what you want to program.
Your project might benefit from a low-level language. Or it might be much more efficient in a high-level one. The key is to choose the right tool for the job. Focus on your goal, and you’ll pick the right language every time.
Do you have experience with both high- and low-level languages? Do you prefer one over the other? Share your thoughts in the comments below!