Programming Languages and Their Types

In this article, we will explore what are programming languages, why are they needed, and their various types.

Nowadays computers are playing key roles in our daily life. They are present in various forms, such as

  • commonly-known laptops, notebooks, desktop computers, servers
  • smartphones, tablets, PDAs, and calculators
  • supercomputers used in space exploration, weather forecasting
  • embedded computers used in Air-conditioners, Printers, Scanners, WiFi routers, and even in Automobile systems.

All these computers have a basic architecture consisting of a set of hardware devices and software packages which can broadly be divided into two categories

  • System Software: a set of instructions that are dedicated to managing the hardware. e.g. operating systems such as Windows, Linux, Mac Os, Android, etc.
  • Application Software: a set of instructions that enable the user to complete tasks e.g. web browsers, mobile apps, media players, etc.
Image for post
Image for post

These sets of instructions are technically called programs or codes. We can see that every device and machine that has a computer in it runs on codes.

The backbones of today’s technology companies like Google, Facebook, Microsoft, Apple, Amazon, and many others, are giant computer programs written by a collaboration of thousands of skilled programmers.

Hence programming is a way to communicate with computers to give instructions to them to perform a particular task. But the problem is that the only language a computer understands is binary, just ones and zeros, which is too difficult to be used alone. Here comes the need for an in-between language through which humans can give effective instructions to computers.

Thanks to the efforts of hard-working researchers and programmers, we have more than 700 programming languages to fulfill the need mentioned above. These programming languages can be organized into various types that provide different levels of functionality.

High-Level Programming Languages

These programming languages are closer to human language than machine code. They are easier to learn and use.

In these languages, a single programming command does many pre-programmed things which makes programming easier, less time consuming, and in general more efficient.

But these functionalities come at the cost of less direct control over the computer. Hence generally they are used for the development of application software.

Some of the high-level programming languages are c, c++, Java, Python, etc.

Low-Level Programming Languages

These programming languages are closer to binary and further from human language. They are not so easy to learn and use.

They take more time as well as lines of code to do the same task as a high-level language. But they are less restrictive and provide direct control over the computer. Hence they are generally used for developing system software.

Some of the low-level languages are assembly, machine code. Some of the high-level programming languages such as c include some degree of access to low-level programming functions. Inline Assembly is another way to make it available in high-level languages.

Programming Paradigms

Other than the classifications of high-level and low-level, there are different styles or ways of programming which are called paradigms. Different languages have different features and hence they allow different ways to solve a problem or to do a task. Different styles of programming are shown in the figure below.

Image for post
Image for post

Now let us know about what imperative and declarative programming are. To understand them first consider the following two scenarios.

Suppose you asked your friend to make a smoothie for you. Now its totally on your friend to choose how he/she likes to make it and which fruits to choose.

But suppose you asked your friend to make a smoothie but this time you instruct him/her about what fruits to choose and how to make it.

The first scenario is a metaphor for declarative programming which is a style of building the structure and elements of computer programs without describing its control flow. Languages that support this paradigm are markup languages (e.g. HTML), SQL, yacc, Prolog, modeling languages, etc.

The second scenario is a metaphor for imperative programming which focuses on describing how a program operates. In this paradigm, the program describes a sequence of steps that change the state of the computer. Languages such as c, Java, Python, etc. support this style of programming.

Unlike declarative programming, which describes “what” a program should accomplish, imperative programming explicitly tells the computer “how” to accomplish it.

Now let us dive deep into various paradigms shown in the figure above.

  • Procedural Programming Paradigm: This is based on the concept of procedure calls. Procedures, also known as routines, or functions, simply contain a series of computational steps to be carried out which gives the ability to reuse the code as many times as required. Languages that support this style are c, c++, Pascal, etc.
  • Object-Oriented Programming Paradigm: This is based on the concept of “objects”, which can contain data in the form of fields and code in the form of procedures. Object’s procedures can access and often modify the data fields of the object with which they are associated. See this article to know details about the OOP concepts.
  • Parallel Processing: Consider a numerical [(23 x 27)+(32 x 36)]. The normal way of solving this is to first calculate (23 x 27) and then calculate (32 x 36). Finally, add the result of both. But suppose you gave your friend to calculate (23 x 27) and you calculate (32 x 36). Finally, you add both the answers. Which one is a faster approach? The first approach is called sequential computation i.e. computing one after the other while the second approach is called parallel computation. Breaking up different parts of a task among multiple processors will help reduce the amount of time to run a program. Both hardware and software are required for this paradigm.
  • Logic Programming Paradigm: This is based on formal logic. Programs consist of a set of sentences in logical form, expressing facts and rules about some problem domain. Machines produce results based on the knowledge base which is known in advance. Languages such as Prolog, Mercury, etc support logic programming.
  • Functional Programming Paradigm: The key principle of this paradigm is the execution of a series of functions. In this approach functions are treated as first-class citizens, meaning that they can be bound to names (including local identifiers), passed as arguments, and returned from other functions, just as any other data type can. Languages like Perl, javascript, scala mostly uses this paradigm.
  • Database/Data-driven Programming: In this paradigm the program statements describe the data to be matched and the processing required rather than defining a sequence of steps to be taken. A database program is the heart of a business information system and has wide applications. Many database use SQL statements to perform data-related tasks.

Now questions arise such as “which is the best programming paradigm” or “which is the best programming language”. A general answer is that it depends upon the problem in front of you. The best paradigm/language is the one that enables you to solve the problem efficiently. Yes, it’s all about you and your team. You may need to use a different language or a different approach to solve a different problem.

Do check this article to dive into the concepts of Object-Oriented programming in Java.

Written by

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store