Category:Programming paradigm/Imperative

From Rosetta Code
(Redirected from Imperative programming)
Programming paradigm/Imperative is a programming language feature.

Imperative programming is a programming model opposed to declarative programming. As the name suggests, imperative programming involves giving instructions for what to do in order to solve a problem. Declarative programming describes the problem, leaving the solution to the inference system.

More formally, imperative programming requires identifiable computation states, and transitions between these states with imperative instructions. Declarative programming requires a well-defined class of problems for which a close to optimal solution is implementable with the existing software and hardware.

Low level computational models and hardware are traditionally imperative. One exception is represented by analog computers, which were declarative in the way they were programmed. Therefore, the first generations of programming languages were imperative, as well as the precursor concept of an algorithm.

During the evolution of programming languages the computational states became more abstracted and less directly mapped to the hardware states. In the fourth generation of programming languages, languages were used to replace imperative programs with declarative ones. This led to domain-specific programming languages, because declarative programming is necessarily limited to only the problems for which the solution is known. Then the process of drifting towards declarative programming reached its equilibrium, as the maintenance of declarative solutions written in multiple languages became a problem due to language impedance. Furthermore, understanding of complex declarative solutions is—in general—more difficult, effects of errors are less predictable, performance optimization is hard, etc.

Presently, in the higher level languages, the margin between imperative and declarative is very blurred. General purpose languages contain both imperative and declarative constructs.

Subcategories

This category has the following 99 subcategories, out of 99 total.

8

A

B

C

D

E

F

G

H

I

J

  • J(3 C, 1,413 P)
  • Java(3 C, 1,420 P)
  • Jinja(4 P)

K

L

M

N

O

P

Q

R

  • Raku(3 C, 1,632 P)
  • RTL/2(3 C, 1 P)
  • Ruby(3 C, 1,239 P)
  • Rust(2 C, 1,025 P)

S

T

U

V

Y

Z