In this imperative program, I have told you the exact steps to take in order to build the house (okay, not so detailed, but you get it!).ĭeclarative is about the WHAT. For example, if I was writing an imperative program for building a house, it would go something like this: Imperative programming is about how a program works while Declarative programming is about what a program does.
The difference between Imperative and Declarative programming is related to how a program works vs. The diagram above doesn't make sense yet especially because Object-Oriented Programming (OOP) is listed under both categories!
#Declarative programming language list code
By understanding these five terms, while reading code libraries, you will begin to see where the authors got their code designs.Īll five of these terms are considered "programming paradigms", although Imperative and Declarative paradigms are parent hierarchies to procedural, object-oriented, and functional programming. In my mind, knowing the difference between imperative and declarative programming is useful for a single reason, and that is to help you better understand the difference between procedural, functional, and object-oriented programming styles. Maybe you're reading a textbook for school.Įventually, you get annoyed reading the terms "declarative" and "imperative" because you know they are important but have no clue why. A description of the conditions of the problem and logical relations is given, according to which the programming system itself calculates the possible consequences and relationships of the entered data and formulas.Maybe you heard it in an Object-Oriented Programming book.
A program written in a logical programming language does not contain specific algorithms (actions and commands like do this, then this). It is based on formal logic and Boolean algebra (in some languages, fuzzy logic tools are used, which allows the creation of artificial intelligence systems). The languages of this group have relatively low speed due to the complexity of implementation. Functional programming is considered to be an ultra-high level programming. Algorithms written in a functional form are usually shorter and contain fewer errors than similar object-oriented or procedural ones. Functional programmingĪ program consists of a set of functions that call each other. Logic programs are not distinguished by high speed, since the process of their execution is reduced to the construction of direct and reverse chains of reasoning by various search methods. The language itself is looking for a solution using the search and matching methods that it contains. A program in the Prolog language is built from a sequence of facts and rules, then a statement is formulated that Prolog tries to prove with the help of the rules. In 1973, the artificial intelligence language Prologue ( PROLOG ) (Programming in Logic) was created. Logical programming is programming in terms of logic. This language allows you to handle large amounts of textual information. The first language was Lisp ( LISP, LIST Processing-list processing) created in 1959. The expression is calculated by reducing the complex to the simple. A program written in a functional language is a sequence of descriptions of functions and expressions. The key concept in functional languages is expression. Functional programming does not use memory, as a place to store data, and, therefore, does not use intermediate variables, assignment operators, and cycles. Functional programming is a way of composing programs in which the only action is a function call. These include functional and logical programming languages.