3 ms·
I learned java in school and used C# professional for year. Almost every useful refactoring I perform in C# is based on functional concepts. You can slap patter
by nahname 14y ago
I learned java in school and used C# professional for year. Almost every useful refactoring I perform in C# is based on functional concepts. You can slap patterns on a mess to provide order or you can introduce functional concepts to remove it, almost entirely.
I am not trying to dismiss patterns, but when you have lambda's you have a free way to add a visitor, command or specification to your code. It is one line instead of three interfaces and a bunch of shared understanding.
Consider,
var even = (new [1,2,3,4]).Select(x => x % 2 == 0);
The select statement gives you a way to interrogate individual objects, in the same way you could if you built up all the plumbing for a visitor pattern. What did I have to add to do this? Nothing. C# is awesome.