Types of Programming Languages Explained (Simple)

Retro Computer

Everyone involved in programming has to deal with different types of programming languages at some moment in time. It is valuable for beginners to have a basic understanding of the meaning and use of each type. By knowing about the advantages and disadvantages of each type, you can make smarter decisions in which languages to learn and to apply.

If you are completely new to programming you can take a look at this article.

High and Low level Programming Languages

High and low level programming languages are distinguished by looking at the amount of abstraction they have. Abstraction is simplifying the technical details so only the general concepts remain. The goal of this is to make the language easier to understand and work with.

A simple example of abstraction is using a microwave. You can give it general commands by just touching a button, like start, stop or pause. By using the buttons you can use the microwave to heat up food. The technical process inside the microwave is hidden from you and is executed automatically without you having to know about it.

Low level languages are closer to the technical process and the language or code a computer can directly execute. So they have a low level of abstraction. Adding more abstraction, removes technical details and leads to a language becoming more high level.

You can further break down the categories of low and high level languages. Low level languages can be broken down in machine language and assembly language. While high level languages is a much broader category and is for now broken down in procedural and object orientated languages.

Machine Language

Machine language consists of binary code, values of ones and zeros. It is the language that can be processed by a computer to actually execute commands. All higher level languages have to eventually undergo some form of translation into machine language.

A single binary value is called a bit, while a set of 8 bits is called a byte. Binary data takes a lot of space and can be overwhelming when displayed. Hexadecimal code is sometimes used to “compress” binary data to make it better readable.

Writing machine language directly is not realistic, because it requires a huge amount of work with little gain and is also very prone to error. Machine language simply looks random and can not be interpreted by the naked eye.

Advantages:

  • Direct execution
  • Exact precision

Disadvantages:

  • Not feasible for humans to write

Assembly Language

An assembly language is more abstract than machine language. It uses combinations of letters, so it starts to look like human language. These combination of letters are specific instructions to be executed by the CPU, the “brain”of a computer. The letters are also called mnemonics.

Before the instructions can be executed they have to be translated to machine language. Something called an assembler translates the assembly language into machine language, which can then be executed by the CPU.

There are different assembly languages. The specific language used is dependent on the CPU architecture. Different architectures exist, for example the x86 architecture of Intel.

There are different reasons to use assembly language. Assembly language is typically used when a high level control over the hardware is needed. This means that performance and precision are crucial for the program that is being written. An assembly language is also used or even developed when a higher level language does not support needed instructions for the CPU.

However because of the low amount of abstraction, everything has to be specified which is time consuming and leads to long development time.

Advantages:

  • Control over hardware
  • Better timing and performance

Disadvantages:

  • Long development time
  • Very dependent on the hardware

Procedural Language

A procedural language is a lot closer to human language. The amount of abstraction is a lot higher compared to assembly language. It uses clear English words. However, you need some technical background knowledge about the language to understand what is written. An example of a procedural language is Fortran.

Code is built on a series of procedures, series of steps that execute in chronological order. You have to work with two basic elements: functions and variables. This makes procedural programming easy to understand and apply.

A major problem of procedural programming is the high dependence of the different parts of code. Adjusting and improving code is difficult. Mistakes in the code have big consequences. A non functioning sequence leads to the whole program not functioning, as the code sequences depend on each other.

Higher level languages, like procedural languages need a compiler or interpreter to translate the code into machine language. This is necessary, because as mentioned before this is the only language a CPU can process.

Advantages:

  • Simple to understand and apply

Disadvantages:

  • Security
  • Difficult to change

Object Oriented Programming

Object oriented programming is slightly more abstract than procedural programming. It is also the most popular type of programming. An example of an object oriented programming language is C#.

A program is built by orientating around objects. Objects are initiated through classes that can be reused over and over again. Classes consist of methods and properties. A program is built through the interaction of the methods and properties of different classes.

A set of classes is called a library. The ease of reusing parts of code makes it very efficient to write complex programs. Programmers can reuse a constructed library or libraries constructed by other programmers.

Object orientated programming is a solution for the interdependence of procedural programming. The organization in classes makes it easy to apply changes and constantly adapt the code.

In procedural programming, functions and variables are separated and form the main building blocks. In object orientated programming these two are combined within objects as properties and methods, then the objects are used as the main building blocks of object orientated programming.

To better understand object orientated programming you have to get four main concepts: Inheritance, encapsulation, abstraction and polymorphism.

Encapsulation refers to the protection of sensitive code from being accessed wrongfully. By organizing code in objects with different methods and properties, access can be regulated. Access to only necessary parts of code can be giving while shielding sensitive parts.

With inheritance objects can take over properties and methods from other objects. This way objects can interact with each other.

Abstraction is nothing more than hiding specific details and keeping the general commands. You then get a better oversight and more simple code.

Polymorphism is a bit harder to understand. The general idea is to make the code more adaptive by letting an object take different forms depending on the input given.

Advantages:

  • Efficient
  • More concise code
  • Code security

Disadvantages:

  • Can be hard to understand and implement