r/programming • • Aug 05 '19

Why Declarative Coding Makes You a Better Programmer

http://minborgsjavapot.blogspot.com/2019/08/why-declarative-coding-makes-you-better.html
0 Upvotes

15 comments sorted by

View all comments

2

u/masterofmisc Aug 05 '19

If you are using C# he is basically replace all your imperative for loops with Linq queries where possible!

... which is good advice that you cant grumble with.

Lambda functions such as map (Select in Linq), Where, Filter etc are common place now in languages like Python, C#, Java & JavaScript, etc.

5

u/tulipoika Aug 05 '19

It’s good only if you know what you’re doing and can live with the possible performance issues. In most cases it’s fine and speed of development is more important, but in some cases the little streams become a big river.

LINQ has come a long way and will be even better in the future.

2

u/scottmcmrust Aug 05 '19

Resharper can do this automatically. Using that feature is often a good demonstration of why that advice is not necessarily good advice, and I tend to Ctrl-Z after trying it.