Declarative programming - Wikipedia

Declarative programming

In computer science, declarative programming is a programming paradigm that expresses the logic of a computation without fully describing its control flow.1

The paradigm focuses on abstracting a program beyond the order of execution. This implies usage of a high-level programming language.

Languages that permit this style allow a developer to minimize or eliminate side effects by describing what the program must accomplish in terms of the problem domain, rather than fully describing how to accomplish it as a sequence of the programming language primitives (the how being left up to the language’s implementation). Declarative programming is in contrast with imperative programming, which implements algorithms in explicit steps.23

Just like in the functional programming paradigm, mutating variables does not conform to the declarative paradigm because it implies an execution order which is imperative.

Declarative programming may consider programs as theories of a formal logic, and computations as deductions in that logical theory. Declarative programming at times simplifies the writing of parallel programs.4

Common declarative language paradigms include logic programming (e.g., Prolog, Datalog, answer set programming), and algebraic modeling systems.

Some logic programming languages, such as Prolog, and database query languages, such as SQL, while declarative in principle, also support a procedural style of programming.5

Other definitions:

  • Any programming language that lacks side effects, or more specifically, has referential transparency.
  • A language with a clear correspondence to mathematical logic.6

Printed 2026-10-25.

(echo:: @ ᯤ)

Footnotes

  1. Lloyd, J.W. (September 19–22, 1994). “Practical Advantages of Declarative Programming” (PDF). In Alpuente, María; Barbuti, Roberto; Ramos, Isidro (eds.). GULP-PRODE’94 1994 Joint Conference on Declarative Programming. Vol. I. Peñíscola, Spain. pp. 3–17. ↩

  2. Sebesta, Robert (2016). Concepts of programming languages. Boston: Pearson. ISBN 978-0-13-394302-3. OCLC 896687896. ↩

  3. “Imperative programming: Overview of the oldest programming paradigm”. IONOS Digital Guide. 2021-05-21. Archived from the original on 2022-05-03. Retrieved 2023-05-23. ↩

  4. “DAMP 2009: Workshop on Declarative Aspects of Multicore Programming”. Cse.unsw.edu.au. 20 January 2009. Archived from the original on 13 September 2013. Retrieved 15 August 2013. ↩

  5. “SQL Stored Procedures”. www.w3schools.com. Retrieved 2026-08-02. ↩

  6. Chakravarty, Manuel M. T. (14 February 1997). On the Massively Parallel Execution of Declarative Programs (Doctoral dissertation). Technische Universität Berlin. Archived from the original on 23 September 2015. Retrieved 26 February 2015. In this context, the criterion for calling a programming language declarative is the existence of a clear, mathematically established correspondence between the language and mathematical logic such that a declarative semantics for the language can be based on the model or the proof theory (or both) of the logic. ↩