What do the terms functional, declarative, and imperative programming mean?
相关问题
- What do we call the combined path, query, and frag
- “Scraping” vs. “Scrapping”: Is there a difference?
- What is the correct term for _ in a type hint?
- CSS media query operators
- What is the correct terminology of XML's eleme
相关文章
- What does “exposition only” mean? Why use it?
- “Adapter” or “adaptor”?
- What is {{$guid}} used for in Postman?
- What is a bit field in layman's terms?
- CSS pseudo-class vs. pseudo-selector
- What does “CL” mean in a commit message? What does
- Does the implementation of pow() function in C/C++
- Model-driven development: What is a transform?
Imperative programming: telling the “machine” how to do something, and as a result what you want to happen will happen.
Declarative programming: telling the “machine” what you would like to happen, and letting the computer figure out how to do it.
Example of imperative
Example of declarative
Note: The difference is not one of brevity or complexity or abstraction. As stated, the difference is how vs what.
Imperative Programming means any style of programming where your program is structured out of instructions describing how the operations performed by a computer will happen.
Declarative Programming means any style of programming where your program is a description either of the problem or the solution - but doesn't explicitly state how the work will be done.
Functional Programming is programming by evaluating functions and functions of functions... As (strictly defined) functional programming means programming by defining side-effect free mathematical functions so it is a form of declarative programming but it isn't the only kind of declarative programming.
Logic Programming (for example in Prolog) is another form of declarative programming. It involves computing by deciding whether a logical statement is true (or whether it can be satisfied). The program is typically a series of facts and rules - i.e. a description rather than a series of instructions.
Term Rewriting (for example CASL) is another form of declarative programming. It involves symbolic transformation of algebraic terms. It's completely distinct from logic programming and functional programming.