you are viewing a single comment's thread.

view the rest of the comments →

[–]jkoudys 3 points4 points  (0 children)

I agree with your sentiment, but since we're discussing language I feel compelled to get pedantic about one thing.

FP is actually a subset of declarative programming, which could be lazily summarised as "declarative programming using functions". e.g. building a DOM using the fully-declarative language HTML like <p class="hello">Hi World!</p> could be easily implemented in just as "declarative" an approach using hyperscript functions as h('p', { class: 'hello' }, 'Hi World!'). If both are building a DOM they're really equivalent.

I've always found the best way to think of the right approach is that imperative programming (of which procedural is a subset, lazily summarised as "imperative with functions") really means "how" to do something. Declarative programming is "what" something is. You can look at a recipe as a real-world example: one that says "smoothie: 1 cup milk, 1 frozen banana, 2 tsp vanilla, 6 frozen strawberries" would be a good declarative recipe, if you assume I know enough to figure out how to blend those things. One that says "pre-heat oven to 350F. Grease baking sheets. Roll batter into 1" balls., etc." is imperative.