Cuttings: Declarative, Imperative, Functional Sandwiches Declarative, Imperative, Functional Sandwiches | Cuttings
Things of interest.


 
December 3, 2017

Declarative, Imperative, Functional Sandwiches


Programming paradigms and sandwiches.

From Reddit:

Declarative programming says, “Make me a sandwich.”

Imperative programming says, “Get peanut butter. Get a knife. Get bread. Scoop peanut butter using the knife. Spread peanut butter knife over bread.”

Functional programming says (and here the analogy breaks down a little), “Transform a closed jar of peanut butter into an open jar of peanut butter. Transform the open jar of peanut butter and a knife into a knife with peanut butter on it. Transform the knife and a slice of bread into a sandwich.”



 

 
© 1997 - 2018 / Info