Hacker News new | ask | show | jobs
by camus 4824 days ago
well one declares variables:

    - given a pan
    - given 3 eggs
    - given a little of olive oil
then one executes orders :

    - add the oil in the pan
    - break the eggs and add them in the pan
    - cook the eggs fo 5 mins
    - serve the food hot
so i guess one is never really doing either pure declarative of imperative cooking/programming ?

I like the cookbook metaphore for programming.

1 comments

It is actually even more interesting in some respects. You consider "break the eggs and add them in the pan" as an imperative command; yet it has to be learned. Just going off of that there are so many ways it can go wrong it is frightening. Consider, how do you break the eggs, and do you add the entirety to the pan? (yes, I just watched my 3 year old try this recently.)

So, don't get me wrong. I'm all for declarative actions. I just think the "purely declarative" approach that many languages try and impose is a useful aberration when you consider how the vast majority of "programming" is done.