A programming language “is a language designed to describe the set of consecutive actions that a command must execute. Therefore, a programming language is a practical way for humans to give instructions to a team.
On the other hand, the term “natural language” defines a medium of communication shared by a group of people (e.g. English or French).
The languages that computers use to communicate with each other have nothing to do with programming languages; they are known as communication protocols. These are two totally different concepts. A programming language is very strict:
The language used by the processor is called machine language. It is data as it arrives at the processor, which consists of a series of 0 and 1 (binary data).
Machine language, therefore, is not understandable for humans, which is why intermediate languages have been developed understandable for man. The code written in this type of language is transformed into machine code so that the processor can process it.
The assembler was the first programming language used. It is very similar to machine language, but developers can understand it. However, this language is so much like machine language that it depends strictly on the type of processor used (each type of processor can have its own machine language). Thus, a program developed for one team cannot be ported to another type of team. The term “portability” describes the ability to use a software program on different types of equipment. In order to use a software program written in an assembler code on another type of equipment, it will sometimes be necessary to rewrite the whole program!
Therefore, a programming language has several advantages:
- Is much easier to understand than a machine language:
- Allows greater portability that is to say it can be easily adapted to run on different types of equipment.
- Imperative and functional programming languages
Programming languages are generally divided into two main groups based on the processing of their commands:
- Imperative languages;
- Functional languages.
Imperative programming language
An imperative language is programmed by a series of commands, grouped into blocks and composed of conditional commands that allow the program to return to a block of commands if the condition is met. These were the first programming languages in use and even today many modern languages use this principle.
However, structured imperative languages lack flexibility because of sequential instructions.
Functional programming language
A functional programming language (often called procedural language) is a language that creates programs by functions, returns a new result state and receives as input the result of other functions. When a function calls itself, we speak of recursion.
Interpretation and compilation
Programming languages can broadly be divided into two categories:
- Interpreted languages
- Compiled languages
A programming language is, by definition, different from machine language. Therefore, it must be translated so that the processor can understand it. A program written in an interpreted language requires an auxiliary program (the interpreter), which translates program commands as needed.
A program written in a “compiled” language is translated through an append program called a compiler which, in turn, creates a new independent file that does not need any other program to run itself. This file is called executable.
A program written in a compiled language has the advantage of not needing an attached program to be executed once it has been compiled. In addition, since only one translation is required, execution becomes faster.
However, it is not as flexible as a program written in interpreted language, since each modification of the source file (the file comprehensible for humans: the file to be compiled) requires the compilation of the program to apply the changes.
On the other hand, a compiled program has the advantage of guaranteeing the security of the source code. In fact, interpreted language, being directly a readable language, makes that anyone can know the secrets of a program’s manufacture and, thus, copy its code or even modify it. Therefore, there is a risk that copyright will not be respected. On the other hand, certain secured applications need code confidentiality to avoid illegal copying (bank transactions, online payments, secure communications …).
Some languages belong to both categories (LISP, Java, Python …) since the program written in these languages can, in certain cases, undergo an intermediate compilation phase, in a file written in an unintelligible language (therefore different To the source file) and not executable (would require an interpreter). Java applets, small programs that are often loaded into web pages, are compiled files that can only be executed within a web browser (they are files with a .class extension).