DEV Community

Discussion on: Why I love learning functional programming

 
ksaaskil profile image
Kimmo Sääskilahti

Good question! I wouldn't call those declarative, because they modify state, or at least they don't return anything. I would also expect the function names to convey some intent that's understandable in the context of the program.

As long as we don't have a clear definition of declarative programming that we both agree on, I don't think we'll reach agreement of what code should be called declarative and what imperative. Maybe that's not that even so important in practice, to me it's most important that code is easy to read and understand and it has zero surprises.

Imperative code feels, though, easier to recognize when I see it 😊