When learning to code, one of the first things I was curious about was the difference in programming language levels. I recently did a deep dive into these different levels and put together this comprehensive guide with useful and interesting information.
One thing to point out is that the definitions of the various programming language levels have changed as programming languages have evolved, but I’ll expand on that later.
Programming Language Levels
Programming language levels refer to the level of abstraction of a given language.
There are two main levels of programming languages:
- Low-Level Languages: Machine Code and Assembly Language.
One way to think of the difference in these abstraction levels is as follows:
Each statement written in low-level languages corresponds to a single instruction for the computer. On the other hand, each statement written in high-level languages corresponds to multiple instructions for the computer. For the sake of this post, the more instructions per coding statement that a language is capable of, the higher its level.
Thus, low-level languages run faster and perform better than high-level languages.
Low-Level Programming Languages
- Machine Code
- Assembly Language
These are examples of low-level programming languages.
Low-level languages have a low level of abstraction than high-level programming languages. Because of this, Low-Level code is more easily read by computers and is faster at runtime. However, although this code runs more efficiently, it’s not efficient for developers to write.
Some programming languages such as Java and Python code look more like plain English when compared to Machine Code or Assembly Language.
Machine language or machine code is the only language that computers can understand and receive instructions. These machine languages are often either binary or hexadecimal code.
Binary is a system of using only zero’s and one’s to compose characters, text, and everything else that appears on a computer screen.
Although there are higher levels of programming languages than machine code, the higher-level code must first be interpreted or compiled into machine code in order for the computer to receive those instructions.
Here’s an example of binary that creates the word: hello.
01101000 //h 01100101 //e 01101100 //l 01101100 //l 01101111 //o
Notice how there are 8 binary bits per letter. These 8-bit sequences are called a byte.
Additionally, when compared to a print statement with the Python language, you can see just how much easier it is for people to understand higher programming language levels.
Assembly is the closest language to Machine code.
However, assembly language gets converted into machine code by an assembler so it can pass instructions to the computer that are low enough level for the computer to understand.
It’s important to note that Assembly language is a general term for the low-level programming language that communicates with a computer’s hardware.
This means that the assembly language is different depending on the computer that it’s running on. In fact, there are many different types of assembly language but the four main types are CISC, RISC, VLIW, and DSP.
High-Level Programming Languages
These are all examples of high-level programming languages.
High-level languages have a higher level of abstraction than low-level languages. They also tend to be much closer to spoken languages such as English. Because of this, high-level languages make it easy for programmers to read and write code.
However, that code will not run as fast as the same program written in a low-level language because it must first be interpreted or compiled into machine code.
Java has been one of the most popular high-level programming languages in the world for some time. What makes Java so popular is that it’s a high-performance language with a large library and medium difficulty to learn and use.
However, although Java is more performant than Python, it’s still not as easy to learn and use as Python in most cases. Typically, you could take a Java program and rewrite it with Python using less code.
These are good indicators that Python is higher level than Java.
Python is another extremely popular high-level programming language. The reason behind Python’s rise to stardom lies in its performance, versatility, and beginner-friendly syntax.
In fact, when compared to other programming languages, Python reads closer to English than most. Let’s take a look at a quick Python example:
name = 'Tim' print('Hello, ' + name)
The first line of code creates a variable called “name” containing the text “Tim”. The second line prints a simple variable using the new message: Hello, Tim.
Middle-Level Programming Languages
C language is an example of a middle-level programming language.
Some developers believe that high-level programming languages should be further divided to represent a middle level.
For instance, C has characteristics of both high-level and low-level languages.
Therefore, the distinction is often made for a middle programming language level.
Is C a High-Level Programming Language or a Middle-Level Language?
C is both a high-level programming language and a middle-level programming language.
To clarify, C has always been known as a high-level language.
However, after higher-level languages such as Python have appeared, many developers believe it’s fitting to categorize C as a middle-level language.
What is a Very High-Level Language?
Very High-Level Language (VHLL) was a term that was used in the 1990s to describe languages such as Python, Perl, Ruby, and Visual Basic.
Today, these are simply known as high-level languages while C can reasonably be thought of as a middle-level language.
However, these languages that were once referred to as VHLLs aren’t even the highest level languages out there.
That is to say that other languages have a higher level of abstraction.
What is the Highest Level Programming Language?
Currently, the highest level programming language is Prolog. Prolog is a logic programming language used mainly in Artificial Intelligence including IBM’s Watson. The reason that Prolog is the highest level language is that it has the highest level of abstraction.
Unlike other high-level languages, Prolog doesn’t set instructions and then translate them into machine code. Rather, it sets programming logic using facts and rules that the computer must follow when commands are made, leaving the computer to determine the specific instructions.
I asked this question on Reddit and this was one of the top responses:
Let’s look at an example of Prolog:
?- tim(male). /* this is a query asking if i'm a male */
The query above is asking if I (Tim) am a male.
As long as there is logic stating that I am a male then the query will return a value of true. Of course, this is a very basic example and doesn’t showcase the language’s level of abstraction as well as a larger program. However, it does give an idea of the simple syntax and readability.
What is the Lowest Level Programming Language?
The lowest level programming language is machine language which provides little to no abstraction from the computer’s architecture. Machine code can be either binary or hexadecimal.
Machine code is a native computer language which means machine code is the language that computers speak. Because of this, machine language has the highest level of performance.
However, it isn’t practical to create applications by writing computer code. That’s why we have the need for high-level languages that can eventually be translated into machine code with some loss of performance.
Programming Languages From Lowest to Highest Level
- Machine Code (Binary): Composed of 0’s and 1’s that refer to simple states, 1 being ‘on’ and 0 being ‘off’. This binary machine language is the lowest programming language level.
- Machine Code (Hexidecimal): Composed of hexidecimal values that strongly correlated to binary. There is only a single level of abstraction between hexidecimal code and binary.
- Assembly Language: A low-level programming language specific to the computer architecture on which it runs.
- FORTRAN: The first high-level language invented.
- BASIC: The second high-level language invented.
- C Language: Was high-level when invented but now regarded as more of a middle-level language. Many newer language are built on top of the C language.
- C++: A cross-platform language used to create high-performance applications.
- Perl: Created to be a highly capable, feature-rich programming language
- Java: A high-level programming language and computing platform.
- PHP: A widely-used general-purpose scripting language used for the web.
- C#: A modern, object-oriented, and type-safe programming language.
- Python: A high-level programming language that reads close to English. Built on the C language.
- SQL: A high-level query language for accessing structured data from databases.
- Prolog: Used for Artificial Intelligence, this is the language with the highest level of abstraction at the moment.
- Spoken Language: Although not a programming language, English and other spoken languages are the standard to which high-level programming languages are held.
History of Programming Languages
- 1689: Binary system was invented by Gottfried Leibniz which became the foundation of modern Machine language.
- 1947: Assembly language was invented by Kathleen Booth.
- 1957: FORTRAN was invented by John Backus at IBM, becoming the first high-level programming language.
- 1964: BASIC was invented by John G. Kemeny and Thomas E. Kurtz, improving on its predecessor and becoming the second high-level language.
- 1972: C language was invented by Dennis Ritchie at Bell Labs.
- 1973: PROLOG was invented by French Computer Scientist Alain Colmerauer and likely the highest level programming language to date.
- 1979: SQL was created by Computer Scientists at Oracle.
- 1985: C++ was developed by Bjarne Stroustrup.
- 1987: Perl was invented by Larry Wall.
- 1991: Python was invented by Guido van Rossum.
- 1994: PHP was created by Rasmus Lerdorf.
- 1995: Java was invented by James Gosling.
- 2000: C# was invented by Anders Hejlsberg at Microsoft.