Imperative vs Declarative

I was watching an AngularJS video, and it said AngularJS had two sides - Imperative and Declarative programming. I looked it up and here it is :

Let's generalize and say that there are two ways in which we can write code: imperative and declarative.

We could define the difference as follows:

  • 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"1 what you would like to happen, and let the computer figure out how to do it.

1 Computer/database/programming language/etc

 

Share Comments
comments powered by Disqus