Imperative programming (from Latin imperare = command) is the oldest programming paradigm. A program based on this paradigm is made up of a clearly-defined sequence of instructions to a computer.
Therefore, the source code for imperative languages is a series of commands, which specify what the computer has to do – and when – in order to achieve a desired result. Values used in variables are changed at program runtime. To control the commands, control structures such as loops or branches are integrated into the code.
Imperative programming languages are very specific, and operation is system-oriented. On the one hand, the code is easy to understand; on the other hand, many lines of source text are required to describe what can be achieved with a fraction of the commands using declarative programming languages.
These are the best-known imperative programming languages:
- Fortran
- Java
- Pascal
- ALGOL
- C
- C#
- C++
- Assembler
- BASIC
- COBOL
- Python
- Ruby
The different imperative programming languages can, in turn, be assigned to three further subordinate programming styles – structured, procedural, and modular.
The structured programming style extends the basic imperative principle with specific control structures: sequences, selection, and iteration. This approach is based on a desire to limit or completely avoid jump statements that make imperatively designed code unnecessarily complicated.
The procedural approach divides the task a program is supposed to perform into smaller sub-tasks, which are individually described in the code. This results in programming modules which can also be used in other programs. The modular programming model goes one step further by designing, developing, and testing the individual program components independently of one another. The individual modules are then combined to create the actual software.