3 ms·
"programming did become fun again when I started using functional programming as my main paradigm" That's exactly what happened to me. Even though I mostly pr
by glassx 15y ago
"programming did become fun again when I started using functional programming as my main paradigm"
That's exactly what happened to me.
Even though I mostly program in C# (at work) and Ruby (for personal projects) these days, my code and my team's is full of functional idioms, mostly thanks to LINQ, lambda support in C# and lazy evaluation (IEnumerable generators).
Now our code is much shorter, way more readable and much safer compared to what it used to be. We avoid mutability and state changes (meaning, we don't use mutable variables or flags), most functions are testable by themselves, code reuse is much better, objects are much thinner, and even 17 old interns are fluent on such idioms by now. In fact, most new hires already come with LINQ experience, which is cool.
I don't know why the "fun" factor was increased so much, but it did for me. I believe it is because we're forced to think in a straight, linear way that produces the cleanest, safest code possible. It is like some kind of puzzle. It's just like working in Haskell: you have to think before you code.
Well, also it helps a lot that mundane tasks such as calculating the largest number in a list is reduced to list.Max()...