Collection
zero Useful+1
zero

Declarative programming

Programming Paradigm
Declarative programming (English: Declarative programming) Programming Paradigm , and Imperative programming Opposite. It describes the nature of the goal and makes the computer understand the goal, not the process. Declarative programming does not need to tell the computer problem domain, thus avoiding the attendant side effects. And imperative programming requires algorithms to clearly point out how to do each step.
Declarative programming is often seen as formal logic The calculation is regarded as deduction. Declarative programming greatly simplifies Parallel computing Since 2009, the difficulty of compiling has attracted much attention.
Declarative language packs include database query languages( SQL XQuery ), regular expression , logic programming, functional programming and configuration management system.
Declarative programming through function Inference rule or term-rewriting (term rewriting) rules to describe the relationship between variables. Its language runtime( compiler or interpreter )A fixed algorithm To produce results from these relationships.
Declarative programming languages are often used as solutions artificial intelligence and Constraint satisfaction problem
Chinese name
Declarative programming
Foreign name
Declarative programming
Category
Programming form

definition

Announce
edit
Declarative programming is often defined as division Imperative Outside of the programming paradigm. At the same time, there are some other definitions that do not simply compare declarative programming with imperative programming, such as:
  • Declarative programming tells the computer what to calculate instead of how to calculate
  • None side effect Or, more precisely, any Reference transparency Programming language for
  • Any programming language with strict computational logic
Some of these definitions coincide.

Subprogramming paradigm

Announce
edit
Declarative programming is a big concept, which contains some well-known sub programming paradigms.

Constrained programming

stay Constrained programming In, the relationship between variables is described in constraints, which defines the scope of the solution of the problem. These constraints are then solved by the application program to obtain a value for each variable and satisfy the most constraints.
Constrained programming is often used as a complement to functional programming, logical programming, and even imperative programming.

Domain specific language

Some famous declarative expressions Domain specific language (DSLs) including yacc Parser , Compile description language Make, Puppet Management configuration language, regular expression and SQL Some subsets of (such as Select queries). DSLs are sometimes very useful and do not need to be turing complete This often makes it easy to express it in a pure declarative way.
Many text markup languages such as HTML MXML XAML and XSLT Often declarative [1]

Functional programming

Functional programming , especially Pure functional programming , trying to minimize the side effects of the state, so it is considered declarative. Most functional programming languages, such as Scheme Clojure Haskell OCaml Standard ML and Unlambda , side effects are allowed.

Logical programming

Logical programming Language such as Prolog Declare the relationship and ask questions about the relationship. Like functional programming, many logic programming languages allow for side effects.

See

Announce
edit