Programming paradigm
A programming paradigm is a coherent style or approach to writing software, classifying languages by concepts such as state, control flow, modularity, and abstraction.
Overview
A programming paradigm is a fundamental style or approach used to structure and express computations in computer programs. Paradigms group languages and techniques by shared concepts—for example, how they handle state, how they organize code into components, or whether they emphasize describing results instead of specifying the exact steps. Languages commonly support multiple paradigms rather than fitting into a single rigid category. For a concise introduction see programming paradigms.
Core characteristics
Paradigms differ along several axes: the treatment of state and side effects, control flow and sequencing, the granularity of modularity, and the primary abstraction mechanisms. Typical contrasts include:
- Imperative versus declarative: one focuses on explicit steps and changing state; the other on expressing what result is desired.
- Stateful versus stateless designs: whether programs rely on mutable data or avoid side effects.
- Structural approaches: grouping code as procedures, classes, functions, or rules.
For more about side effects and order of execution see side effects and control flow.
Major families and examples
Common families include procedural (structured sequences of commands), object-oriented (encapsulated objects and messages), functional (first-class functions and expression evaluation), and logic-based (rules and queries). Other important approaches are event-driven, concurrent, and reactive paradigms. Languages often combine features: procedural and object-oriented features coexist in many mainstream languages, while functional ideas appear increasingly in general-purpose systems. For comparisons of language grouping see language classification and examples of modular design modularity.
History and development
Paradigms evolved with computing needs. Early programming was low-level and imperative; structured programming encouraged clearer control constructs; object orientation emphasized modelling and reuse; functional programming traces to lambda calculus and influenced languages designed for symbolic computation. Logic programming emerged for symbolic reasoning and AI applications. Over time, practical requirements pushed many languages toward multi-paradigm designs.
Practical importance and distinctions
Choosing a paradigm affects program clarity, ease of maintenance, parallelizability, and error patterns. It is useful to distinguish a paradigm (a conceptual approach) from specific language features or libraries. While paradigms can prescribe certain styles (for instance, immutability in functional programming), they are not strict rules and are often mixed in real projects. For summaries of paradigm components see components.
Imperative programming
→ Main article: Imperative programming
In imperative programming "a program (note: i.e. here the source code) consists of a sequence of commands that specify in which order what should be done by the computer". The term is based on the Latin "imperare" ("to order", "to command").
"Most [...] programming languages, including OOP languages such as C#, Visual Basic, C++, and Java, primarily [also] support imperative [...] programming."
Structured programming
→ Main article: Structured programming
A further development of imperative languages was marked by Edsger W. Dijkstra's 1968 paper Go To Statement Considered Harmful, which called for the abandonment or at least the restriction of absolute jump statements (goto); instead, control structures such as "if... then...", "case... of...", "while... do...", "repeat... until..." should be used.
Procedural programming
→ Main article: Procedural programming
The approach of splitting programs into smaller subtasks is called procedural programming. The resulting subprograms are called procedures. Practically all current imperative programming languages include the procedural approach.
The development of procedural programming languages and techniques were an essential step between assembly language and high-level languages by allowing abstraction and decomposition of algorithms.
Modular programming
→ Main article: Modular programming
Modular programming was the first attempt to cope with the growing size of software projects. In modular programming, the procedural approach is extended by grouping procedures together with data in logical units. The software is thus broken down into larger functional sub-blocks that can be planned, programmed and tested individually. The resulting subprograms are called modules. At the end, the individual parts can then be logically linked together and the software is ready for use. Standardized programming describes the attempt to standardize this process. The first strictly modularized programming language was Modula-2 in 1978.
Programming with abstract data types
→ Main article: Abstract data type
Programming with abstract data types treats data and functions to handle that data as a unit.
Declarative programming paradigms
→ Main article: Declarative programming
The idea of declarative programming is the historically more recent approach. In contrast to imperative programming paradigms, which focus on the how, declarative programming asks what is to be computed. Thus, instead of programming the solution path, one only specifies what result is desired. For this purpose, declarative paradigms are based on mathematical, computer-independent theories.
- Due to the referential transparency there are no side effects. Programs are thus partially evaluable and thus enable, for example, the handling of infinite data structures.
- Proofs (e.g. proof of correctness, proofs about program properties) are unrestrictedly feasible thanks to mathematical basis (among others lambda calculus).
- Architecture independence
- partly low acceptance (one likes to speak of so-called academic languages)
Declarative programming languages include:
- functional languages (among others Lisp, ML, Miranda, Gofer, Haskell, F#, Scala)
- logicallanguages (including Prolog)
- functional-logical languages (among others Babel, Escher, Curry, Oz)
- quantity-oriented query languages (including SQL)
Example Quicksort: Haskell is a typical declarative programming language. The programmer describes what the program does with an input, i.e. how to deal with which input, but the computation process is not of interest. The calculations are then done by value manipulation. The main control structure is the recursion, especially for efficiency reasons the final recursion:
Functional programming
→ Main article: Functional programming
The task and the known premises are formulated here as a functional expression. The independent application of function substitution and evaluation on the part of the interpreter or compiler then solve the task. The program can be understood as a mapping of the input to the output.
Logical programming
→ Main article: Logical programming
The task and its premises are formulated as logical statements (rules) (cf. functional programming, see above). The interpreter then tries to derive the desired solution statement. In other rule-based languages such as OPS-5, XSLT, or Prolog, rules are checked against a data set for instantiability. From all rule instantiations, one (several, all) is selected and the statements belonging to the rule are executed.
Constraint programming
→ Main article: Constraint programming
In constraint programming, constraints are defined. It is seen as a natural development of logical programming. Logical and constraint programming are typically used in combination.
Questions and answers
Q: What is a programming paradigm?
A: A programming paradigm is a way of grouping programming languages based on how they operate.
Q: What are the two main groups of paradigms?
A: The two main groups of paradigms are imperative and declarative.
Q: How do imperative and declarative paradigms differ?
A: Imperative paradigms look at the way that code is run, such as allowing side effects or having to do things in a certain order, while declarative paradigms look at the way that code is grouped, such as putting code into one or two pieces (or instead, many small pieces).
Q: Can a language be both an imperative and declarative paradigm?
A: Yes, a language can be both an imperative and declarative paradigm at the same time.
Q: How does a programming paradigm group languages?
A: Programming paradigms group languages by what they do. They look at how the code is run, how it's grouped, and what order and pieces make up the program.
Q: Are there other types of programming paradigms besides imperative and declarative?
A: Yes, there are other types of programming paradigms besides imperative and declarative. For example, some look at the way that code is run (such as allowing side effects), while others look at the way that code is grouped (such as putting code into one or two pieces).
Q: Does every language belong to only one type of programming paradigm?
A: No, not every language belongs to only one type of programming paradigm; some languages can be in more than one type of paradigm.
Related articles
Author
AlegsaOnline.com Programming paradigm Leandro Alegsa
URL: https://en.alegsaonline.com/art/79379
Sources
- ai.uga.edu : "CSCI/ARTI 4540/6540: First Lecture on Symbolic Programming and LISP"
- people.cs.aau.dk : Overview of the four main programming paradigms
- cgi.csc.liv.ac.uk : "Characteristics of declarative programming languages"
- info.ucl.ac.be : "Programming Paradigms for Dummies: What Every Programmer Should Know"
- books.google.com : Concepts, Techniques, and Models of Computer Programming
- dl.acm.org : "Conception, Evolution, and Application of Functional Programming Languages"
- doi.org : 10.1145/214748.315722
- ecn.purdue.edu : "'GOTO Considered Harmful' Considered Harmful"
- cambridgeblog.org : "What, if anything, is a programming-paradigm?"
- dl.acm.org : "Teaching programming languages in a post-linnaean age"
- dl.acm.org : "The paradigms of programming"
- doi.org : 10.1145/359138.359140
- britannica.com : "Computer science - Programming languages"