Hacker News new | ask | show | jobs
by shkkmo 1313 days ago
Declarative works better than imperative only when someone has already defined the imperative process that takes you from any given state to your goal and does that for you based on your declaration.

Google maps works great for a set of origins to a set of departures for certain modes of travel. Once you get outside those bounds, it can fail in significant ways.

Thus the entire premise of the article thus seems to boil down to: If someone has already done the work, don't re-do it.

The problem with declarative configuration is that as the systems they manage become more complex, inevitably you leave the bounds of the solved problem and have to start solving it for yourself imperatively.

2 comments

> Declarative works better than imperative only when someone has already defined the imperative process that takes you from any given state to your goal and does that for you based on your declaration. [emphasis added]

No, someone (as in a person) doesn't have to define the imperative process, that would be stupid. We have computers to compute things, including computing new processes. Oracle didn't hire a bunch of human query planners to manually construct every query plan, they made a query planner. Google didn't sit down a nation of navigators to plan out every route, they wrote a program (or likely a set of programs) that computes it on the fly.

> they wrote a program (or likely a set of programs) that computes it on the fly.

Which is precisely the sort of imperative process I am referrencing...

This is the correct answer.

You can declare only when someone else already has performed the imperative chore, i.e. written the source code, programmed.

Q.E.D.