DEV Community

Cover image for What is a Programming Language?
Araiz Naqvi
Araiz Naqvi

Posted on

What is a Programming Language?

Let's imagine a situation,
You need to talk to a person to ask for something. Now, the situation is that you speak English and Hindi and the other person only speaks Odiyah. So, in this case how do you communicate with this person?

Similarly,
Computers understand 0's and 1's and we can't communicate and write massive code in 0's and 1's. Hence, we use something called a Programming Language which helps us write instructions to a computer in our language.

And, there is a means in the middle which is the Compilation Process which converts our language into a machine understandable language i.e. 0's and 1's.

So, as to speak programming languages can be categorized as follows:

1. By Execution


There are three main categories:

  1. Compiled
  2. Interpreted
  3. JIT (Just in Time)



1. Compiled Languages

Compiled languages also called Ahead-of-Time Compiled languages work in the following manner let's take C++ as an example:


Compilers compile your source code and required libraries into machine code called Executable which are instructions encoded into a particular processor architecture that the CPU can execute directly.

This is used by:

  • C/C++
  • Rust
  • Go


The benefits of compiling or Ahead-of-Time Compilation are:

  • Performance: Code gets optimized
  • Deployment: A compatible executable can run without compiling the source code every time
  • Hardware Control: Offer substantial control over memory and system resources.

Also, compiled does not always mean faster than interpreted languages since that depends on compiler, runtime, workload, libraries and implementation.



2. Interpreted Languages

In interpreted languages, you don't actually explicitly compile the code into an executable.
Let's use python as an example:

As you notice even here, the code is first COMPILED into Python byte-code instructions which is then executed by the python virtual machine. These byte-code instructions are then executed line by line by the virtual machine.

This is used by:

  • Python
  • Ruby
  • PHP
  • Lua



3. JIT Languages

JIT stands for Just In Time Compilation.
It works in a more optimized manner as such:

So, JIT compilation first compiles the src code into an intermediate representation which is run by runtime to identify which code is frequently execute then the JIT compiler will compile that selected code so that at runtime it is executed in an optimized manner.

2. By Abstraction


Abstraction is determined by when you write code, how much is managed by yourself versus the system/language.

The main categories are:



1. Low Level Languages

These languages are closer to the hardware.
You have more control and deal with more machine specific details.
Generally used for hardware control, Embedded Systems and OS internals.

Example:

  • Machine Code
  • Assembly



2. High Level Languages

These languages are closer to human readable logic and hide several hardware details so you can focus on solving problems.
Generally used for applications, websites, software, automation, etc.

Top comments (0)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.