Pro­gram­ming paradigms are the fun­da­ment­al prin­ciples used when de­vel­op­ing software. They are best described as fun­da­ment­ally different pro­gram­ming styles, which in turn result in dif­fer­ently struc­tured software code.

The classic concept is im­per­at­ive pro­gram­ming, where the source code clearly defines which steps a program has to complete and in what order. Sub-types include pro­ced­ur­al and object-oriented pro­gram­ming. On the other hand, the de­clar­at­ive pro­gram­ming principle involves de­scrib­ing only what software should do (i.e. only the result and not the in­di­vidu­al steps). Sub-types include func­tion­al pro­gram­ming and logic pro­gram­ming. How do the two pro­gram­ming paradigms differ from one another?

Im­per­at­ive pro­gram­ming: The classic pro­gram­ming paradigm

Among pro­gram­ming paradigms for software de­vel­op­ment, im­per­at­ive pro­gram­ming is the classic variant. The first pro­gram­ming languages – and cor­res­pond­ingly, the first computer programs – were based entirely on this classic approach, which provides a con­trolled sequence of specific commands (the name comes from the Latin imperare meaning “command”) or in­struc­tions. For example, this pro­gram­ming paradigm is the basis for early classics like Pascal and C, as well as all assembly languages. Im­per­at­ive pro­gram­ming focuses in part on working as closely as possible with the system. The resulting program code is therefore easy to un­der­stand but also very extensive.

Within the im­per­at­ive pro­gram­ming paradigm, there are three important sub­or­din­ate methods for writing and struc­tur­ing software code: struc­tured, pro­ced­ur­al, and modular pro­gram­ming.

Tip

You can find out more about the im­per­at­ive pro­gram­ming paradigm in our cor­res­pond­ing article, which takes a more in-depth look at the topic.

Struc­tured pro­gram­ming

The struc­tured pro­gram­ming method is a sim­pli­fied form of im­per­at­ive pro­gram­ming. The crucial dif­fer­ence from the basic principle is that instead of absolute jump commands (in­struc­tions that lead to pro­cessing con­tinu­ing at another point instead of the next command), this software pro­gram­ming paradigm makes use of control loops and struc­tures. An example is the use of “do...while”, which executes an in­struc­tion auto­mat­ic­ally for as long as a par­tic­u­lar condition is true (at least once).

Pro­ced­ur­al pro­gram­ming

The pro­ced­ur­al pro­gram­ming paradigm extends the im­per­at­ive approach with the pos­sib­il­ity of dividing al­gorithms into more man­age­able sections. Depending on the pro­gram­ming language, these are referred to as sub-programs, routines, or functions. The purpose of this division is to make the pro­gram­ming code clearer and to prevent un­ne­ces­sary code re­pe­ti­tions. Because of the ab­strac­tion of al­gorithms, the pro­ced­ur­al software paradigm rep­res­ents a crucial step from simple assembly languages towards more complex high-level languages.

Modular pro­gram­ming

Modular pro­gram­ming is cat­egor­ised as a sub­or­din­ate form of the im­per­at­ive pro­gram­ming paradigm. It is es­sen­tially very similar to the pro­ced­ur­al method and applies this pro­gram­ming style to the re­quire­ments and demands of larger and more com­pre­hens­ive software projects. It involves se­lect­ively breaking down the source code into logical, in­de­pend­ent sub-blocks to ensure greater clarity and to simplify the debugging process. The sub-blocks, known as modules, can be tested in­di­vidu­ally before they are sub­sequently linked together to create a col­lect­ive ap­plic­a­tion.

De­clar­at­ive pro­gram­ming: paradigm of the recent past

In parallel to the con­tinu­ous ongoing de­vel­op­ment of hardware and software, the de­clar­at­ive method developed as an al­tern­at­ive paradigm for code pro­gram­ming. The fun­da­ment­al principle of de­clar­at­ive pro­gram­ming is that it describes the desired end result. Thus, it is primarily about the “what” – the result – rather than the “how” – the steps towards the solution – as is the case with im­per­at­ive pro­gram­ming. As a con­sequence, because of the high level of ab­strac­tion, the code generated by de­clar­at­ive pro­gram­ming is much more difficult to un­der­stand. At the same time, it is short and precise.

There are much bigger dif­fer­ences between sub­or­din­ate forms of the de­clar­at­ive pro­gram­ming paradigm than there are between those of the im­per­at­ive approach. In addition, they are not always so precisely defined or cat­egor­ised. The two most important methods in the de­clar­at­ive pro­gram­ming paradigm are func­tion­al and logic pro­gram­ming.

Tip

You can find out more about the de­clar­at­ive pro­gram­ming paradigm in our cor­res­pond­ing article, which takes a more in-depth look at the topic.

Func­tion­al pro­gram­ming

Functions exist in every higher-level pro­gram­ming language. However, the func­tion­al approach in software de­vel­op­ment deals with functions in a very par­tic­u­lar way.

A func­tion­ally pro­grammed program is made up of a string of function calls, where each program section can be un­der­stood as a function. In func­tion­al pro­gram­ming, the functions can take on different forms. For example, they can be linked to one another like data or be used in the form of para­met­ers. In addition, they can sub­sequently be used as function results. Con­versely, the paradigm leads to there being no in­de­pend­ent as­sign­ment of values.

This sub­si­di­ary form of de­clar­at­ive pro­gram­ming is very important for computer science in general – and at the same time can be used for a wide range of specific purposes. The special handling of functions enables pro­gram­mers using the func­tion­al method to create and use extensive cal­cu­la­tion rules made up of functions.

Tip

You can find out more about the func­tion­al pro­gram­ming method in our cor­res­pond­ing article, which takes a more in-depth look at the topic.

Logic pro­gram­ming

The logic pro­gram­ming method, also known as predicate pro­gram­ming, is based on math­em­at­ic­al logic. Instead of a sequence of in­struc­tions, software pro­grammed using this method contains a set of prin­ciples, which can be un­der­stood as a col­lec­tion of facts and as­sump­tions. All inquiries to the program are processed, with the in­ter­pret­er applying these prin­ciples and pre­vi­ously defined rules to them in order to obtain the desired result.

Tip

You can find out more about the logic pro­gram­ming method in our cor­res­pond­ing article, which takes a more in-depth look at the topic.

Com­par­is­on of pro­gram­ming paradigms: im­per­at­ive and de­clar­at­ive pro­gram­ming

Im­per­at­ive pro­gram­ming paradigm De­clar­at­ive pro­gram­ming paradigm
“How?” “What?”
Classic New trend
A program based on this paradigm is made up of a series of in­struc­tions that tell the computer what it should calculate/do and in what order. A program based on this paradigm is made up of in­struc­tions for how the program should deal with an input. Cal­cu­la­tions are performed by ma­nip­u­la­tion of values, with the procedure con­trolled by the process of recursion.
The name comes from “imperare”, the Latin word for “command”. The name comes from “declarare”, the Latin word for “describe”.
The desired solution path is specified The desired result is specified.
Typical pro­gram­ming languages include C, Pascal, Fortran, ALGOL, and all assembly languages. Typical pro­gram­ming languages include Lisp, ML, Haskell, F#, Prolog, and Oz
Go to Main Menu