4 ms·
> When I finished the course I really liked Haskell and functional programming because of its clarity, readability and the fact that I could write a very compac
by tesmar2 14y ago
> When I finished the course I really liked Haskell and functional programming because of its clarity, readability and the fact that I could write a very compact code. But I had no practical use for it. It did not change my Programming style but made me look for a more pure and “nicer” language to learn.
Why did it not change your OO style to be more functional? Static methods, no mutation, etc etc?
- deleted 14y ago[deleted]
- stonemetal 14y agoWhy would it? OO languages aren't functional. Trying to misuse a tool seems like a great way to resent it. After learning to use a saw, trying to cut boards with a hammer would be a nightmare.
- loup-vaillant 14y agoIt depends on your OO language. If you have garbage collection, you can at the very least refrain yourself to use mutable state all over the place, especially at interface boundaries. It's not hard: http://loup-vaillant.fr/tutorials/avoid-assignment http://loup-vaillant.fr/tutorials/avoid-assignment
- nahname 14y agoI 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.