Declarative vs. Prescriptive
These are two terms you mostly hear in programming (when used together), but which apply to a lot of other things as well. You need to consider their roots:
- Declare: “Get me this thing”
- Prescribe: “Here is how to get this thing”
In programming, “prescriptive code” specifies exactly how to do something, whereas “declarative code” simply describes an end state, without explaining how to get to that end state. It leaves the details to lower-level code.
A prescriptive language is more detail-oriented. You are specifying everything that it does. Whereas a declarative language is one in which you delegate a lot of the handling to the framework, and just specify your end goals.
It strikes me that any language can be more declarative or more prescriptive depending on how it’s used, and what libraries are used with it. A very prescriptive language might become very declarative if certain libraries are used which handle a lot of the details, leaving the programmer to simply declare what they want to happen.
Why I Looked It Up
I had always wondered. In particular, I had gotten the two terms confused a lot.