Matterholt
2022-10-14
I enjoy working with React.js , and since React is just javascript there should be a good foundation on Javascript. To be an engineer knowledge on general programming is good to have. So here is a blip of understanding, when a programming is Imperative or Declarative.
React abstract the Imperative browser API. By abstracting the browser API, React would be declarative when working with browser API.
“You know, imperative programming is like how you do something, and declarative programming is more like what you do, or something.”
Imperative would something like telling someone that you want chocolate chip cookies and you proceed to tell them exactly how to make the cookies. Declarative would be hey can you get me a chocolate chip cookie.
One has very specific how to get the chocolate chip cookies in your belly. where the other doesn’t really care about how the chocolate get in your belly just require the cookies.
"Am I going to drive an imperative stick shift car or a declarative automatic -Tyler McGinnis"
Other saying ideas on how to think about declarative programming
"Declarative programming is “the act of programming in languages that conform to the mental model of the developer rather than the operational model of the machine.”
"In computer science, declarative programming is a programming paradigm that expresses the logic of a computation without describing its control flow."
Declarative is not always pure and could require the use of Imperative programming.
Functional Programming is a subset of declarative programming. Create function to execute a task and just call on it an you are not worried how the task is performed. map() vrs traditional For loop.
for better and full explanation follow link: Imperative vs Declarative Programming