Functional programming in .NET, why it matters?
Posted: (EET/GMT+2)
For the past couple of years, .NET developers have seen the rise of functional programming in many different areas of the platform. For instance, the C# language got its lambda expressions a couple of years ago, and the LINQ language extensions show us examples of ideas in functional programming. Thirdly, there's the F# language, which is completely a functional programming language, unlike C#. There are numerous other examples as well.
But why would the average Joe developing basic .NET code be interested in functional programming? If you know tight coupling is your enemy and unit testing is something you (would like to) practice, then some of the ideas available in functional programming languages become useful. For instance, in functional programming, functions become very small and more complex operations are composed from these. This immediately leads to good testability, as the smallest functions tend to be atomic.
Another benefit of functional programming is that there are no side-effects. Again, this leads to good testability and loose coupling, both of which are to be found useful in today's thinking.
My take on this? I don't think the majority of .NET developers will move to languages like F#, but the ideas in functional programming could be well taken into any other language. Parallel programming is however a thing that will become mainstream in a couple of years. Since functional programming neatly solved the problem of parallel programming, we're likely to see merging of both C# and functional programming. Let's see what .NET 4.5 brings to us.