|
|
|
|
|
by k__
1751 days ago
|
|
I don't know if that's enough. Understanding the difference between declarative and imperative programming is rather hard with all the abstractions we have today. People always say, declarative programming is defining what you want, not doing the steps needed to get it. But today no imperative interface requires you to do all the steps either, plus, most programming languages use both paradigms at the same time. |
|
The distinction is are you telling the computer *how* to do it, or telling it *what* steps to take.
If, even with access to all of the code, you'd have to ask the computer how it chose to do it to figure out what it did, you have a declarative system. If the code reads like instructions for a recipe, it is imperative.
The complications come with the fact that these two paradigms do not describe all of the possibilities. Notably object oriented and functional designs are neither imperative or declarative. (But may share some features with both.)