Generations of Programming Languages

Generations of Programming Languages

The generations of programming languages shows the evolution process of programming language. As of today, there are many programming languages and types of programming languages out there. In the past, I have posted about Programming Paradigms and discussed few of the paradigms. But what makes them so different?

For instance, let us consider the two paradigms, Imperative and Declarative where Imperative says how to do, to achieve something and Declarative says what to do, to achieve something. What makes them so different? How does defining what gives us a result without defining how?

We all know that our computer processors execute instructions in imperative style because the architecture is imperative, then how does it process a declarative code?

This is because both the paradigms exist in different generations.

Huh, what?

In simple terms, consider the generations as evolution of programming languages. But the right term for programming languages is abstraction and not evolution. Each generation is an abstraction of it’s ancestor. The answer to the above questions is, most of the Declarative languages are in fourth generation and they are abstractions of Imperative languages in third generation. This will be more clear when you read about the fourth generation.

In the earlier days of computers, languages weren’t programmer-friendly languages like today. In fact, there was only machine language. Programming was hard you know 😶. What we use today are totally different types of languages which more advanced and programmer-friendly. Regardless of the number of languages out there today, we should always remember that, deep inside a computer’s heart, our programs still execute as machine codes. How? We shall get to it eventually.

Let’s see the evolution of programming languages. Based on the programming style, which was the result of the levels of abstractions, programming languages are classified into 5 generations.

The First Generation (1GL)

The very first languages are the Machine languages used to program the first generation computers. They are made up of binary numbers (0s and 1s). One can say that the machine language is the mother tongue of a computer. Machine languages are low-level languages and the processors can executed it directly. And so, it did not require translator tools.

The programmers used switches or punch cards for programming depending on the type of the computer.

Advantage

Machine languages, being close to the computer, ran very fast. Just like how we are more efficient with our native language than a foreign language.

Disadvantage

Bugs were harder to debug and fix. Imagine you leaving your office on a nice Friday evening. Suddenly, your boss wants you to fix a production issue. Now you have to debug through a long list of 0s and 1s to identify the issue. And the worst is yet to come. Because, after identifying the bug, you have to prepare a fresh punch card for your program to implement the fix. 😐

Key points

It is,

  1. A low-level language
  2. Computer’s native language and not programmer-friendly
  3. Runs very fast since it is close to the computer
  4. Made of binary numbers (0s and 1s).

The Second Generation (2GL)

Level of abstraction: Made to be programmer-friendly

These were the times of the assembly languages. They are low-level languages and are an abstract of machine languages. Compared to machine languages, assembly languages are more human understandable. The syntaxes of assembly languages are human readable. Programmers can program direct processor instructions within the code. Below is a simple add instruction.

add eax, 1

Assembler

Hold on, if computer speaks in machine language (0s and 1s), how can it understand add?

Yes, it cannot. As mentioned above, any program we write should be converted to machine language for execution. For assembly languages, assembler helps this conversion. Assembler is a translator tool, a program that translates the programs in assembly language into machine language. This conversion process is called assembly. Hmmm.., now we know the reason to their naming 🤔. This was a massive step for it’s successors.

Assembly languages are used to code kernels and device drivers.

Advantages

  1. Being programmer-friendly, when compared to 1GL, it became easier to debug.
  2. Speed is an advantage to assembly languages. At least till they developed the C language. A well coded C program can be performant than an assembly language program.

Disadvantage

The disadvantage of assembly language is their nature of having direct processor instructions which makes it processor-dependent. Same program would require different codes for different processors as the instructions vary per processor.

Key points

Translator tool required: Assembler

It is,

  1. Low-level language
  2. Easier to debug when compared to 1GL
  3. Machine dependent as the instructions are tightly coupled to processors.

The Third Generation (3GL)

Level of abstraction: Made to be more programmer-friendly and introduced more programming concepts.

I would say that the third generation is a milestone in programming. It is during this generation where the programming languages became much more programmer-friendly and machine-independent. Programming languages started to favor the programmers. The third generation abstracts over the second generation introducing new programming concepts that made programming easier. The languages starting from this generation are high-level languages. This generation drew a clear line between how a program should be to the user and how it should be to the machine. Most popular languages such as C, C++ and Java are from this generation. The 3GL languages are procedural and algorithmic languages. A procedural language is the one that follows a set of instructions in order. Sounds imperative huh 🤔? It was starting from this generation, programming languages were broadly classified into paradigms based on their style.

Being programmer friendly, it was easier for programmers to read, code and maintain the code. Unlike assembly languages, the third generation languages are machine-independent and can run on different types of machines. Translator tools such as compilers or interpreters translate the third generation languages to low-level languages.

Key points

Translator tool required: Compilers and Interpreters

It is,

  1. High-level language
  2. Procedural and algorithmic
    • A set of instructions are given in order for execution.
    • Instructs how to achieve the result.
  3. Easier for the programmer to read, code and maintain.
  4. Machine independent.

The Fourth Generation (4GL)

Level of abstraction: Focus more on processing collection of information.

Advancements and abstractions over the third generation languages led to the fourth generation languages making them more programmer friendly and versatile. The fourth generation languages focuses more on processing the information such as a collection of large set of data, like bank transactions, sales of a company, etc. The style of fourth generation languages are more non-procedural and program-generating.

The fourth generation languages included support for domains that worked with data. Below is a list of few of the domains.

  1. Database management
  2. Report generation
  3. Web development
  4. Low code/No code development
  5. Mathematical optimizations

Non-procedural

A non-procedural language says WHAT to do to achieve the result rather than how to do it.

For example, let’s talk about SQL. SQL is a fourth generation language that is used to query data from database. It describes WHAT to query (non-procedural) rather than telling how to query (procedural). The how-to-query part is already taken care by the underlying database software and the programmer doesn’t have to worry about it.

Program-generating

4GL with knowledge base can provide a complete development environment allowing the user to generate source codes from a graphical user interface. The user can drag drop elements in the GUI to create entire source code which can be in 4GL and 3GL.

A common misconception is that program-generating fourth generation languages are 5GL.

The Fifth Generation

Level of abstraction: Focus more on making the computer solve problems.

Next level of abstraction leads to the fifth generation of languages which focuses on problem solving. In this generation, a programmer is not required to write algorithms to solve a problem. In this generation, the user has to provide the problems and constraints to the computer. Fifth Generation languages are used in Artificial Intelligence. Programming paradigms such as Constraint Programming and Logic Programming are 5GL. Prolog, Mercury and OPS5 are some examples of 5GL.

That’s it for my attempt on the generations of programming languages 😀

What’s next?

To make more context out of this post, take a look on my next ones below.

  1. Program translator tools – Assemblers, Compilers and Interpreters
  2. Low-level languages and High-level languages

I hope this post was helpful 😊. If you find this post informative, support us by sharing this with fellow programmers in your circle 😀.

For any suggestions, improvements, reviews or if you like us to cover a specific topic, please leave a comment.
Follow us on twitter @thegeeksclan and in Facebook.
#TheGeeksClan #DevCommunity

Leave a Comment

Your email address will not be published. Required fields are marked *

error

Enjoy this blog? Please spread the word :)

Discover more from The Geeks Clan

Subscribe now to keep reading and get access to the full archive.

Continue reading