r/coding • u/nfrankel • Aug 05 '19
Why Declarative Coding Makes You a Better Programmer
http://minborgsjavapot.blogspot.com/2019/08/why-declarative-coding-makes-you-better.html
3
Upvotes
15
11
u/Paddy3118 Aug 05 '19 edited Aug 06 '19
The author has a skewed idea of declarative programming. If it's declarative, why the need to explicitely change the type of the return value of sum? It looks more like functional style; and if the author doesn't know that then ...
6
u/guoyunhe Aug 05 '19
Thanks for the other comments, so I can save some time not reading the article.
25
u/yoomiii Aug 05 '19
Writing all the code to achieve the desired goal yourself in the imperative approach and using, for example, the pre-made
sumandgroupingByfunctions in the declarative approach is not a fair comparison. You should either implement those functions in the declarative example or import some magically previously defined function sum() in the imperative approach, which would make it a one liner.