Declarative Programming

What Does Declarative Programming Mean?

Declarative programming is a programming paradigm in which the programmer defines what needs to be accomplished by the program without defining how it needs to be implemented. In other words, the approach focuses on what needs to be achieved instead of instructing how to achieve it. It is different from an imperative program which has the command set to resolve a certain set of problems by describing the steps required to find the solution. Declarative programming describes a particular class of problems with language implementation taking care of finding the solution. The declarative programming approach helps in simplifying the programming behind some parallel processing applications.


Techopedia Explains Declarative Programming

Order of expression or statements or the replication of a statement would not have any impact in declarative programming. Declarative programming can be further categorized into constraint programming, logic programming and constraint logic programming. Prolog, SQL and embedded SQL are some of the well-known examples of declarative programming languages. Tools are provided to programmers in declarative programming to allow abstraction of the implementation and to help in the concentration of the issue.

There are many advantages associated with declarative programming. First of all, it minimizes mutability. Immutable data structures help in eliminating hard-to-detect bugs and are easier to handle. Programmers would find it easier to work with such programming approaches rather than ones with unclear procedures, implicit dependencies or with lots of mutable states. Another benefit with declarative programming is it reduces state side effects by favoring the use of complex constructs like higher order functions and pipelines and by discouraging variables. The programming approach also helps in making the code more understandable and more scalable.


Related Terms

Margaret Rouse
Technology Expert

Margaret is an award-winning technical writer and teacher known for her ability to explain complex technical subjects to a non-technical business audience. Over the past twenty years, her IT definitions have been published by Que in an encyclopedia of technology terms and cited in articles by the New York Times, Time Magazine, USA Today, ZDNet, PC Magazine, and Discovery Magazine. She joined Techopedia in 2011. Margaret's idea of a fun day is helping IT and business professionals learn to speak each other’s highly specialized languages.