What would be real use cases of functional programming in the .NET world (F#)?


Recently (ok, it's been a good few months now) I've been learning about the F# language , which is Microsoft's answer to offering a working programming language on the .NET platform.

However, it was not clear to me the real cases and advantages of using this paradigm over "traditional" object-oriented languages ​​that are already well consolidated (in this case, C# or VB.NET).


  • In which cases does functional programming enable solutions that object-oriented programming is faulty / time-consuming / impossible?
  • Are there any use cases of this language/paradigm in known (or open-source ) projects?
  • From a professional point of view, for the demands of our (Brazilian) market, is it worth deepening the knowledge in this paradigm?


Although the Imperative programming paradigm is the most popular among [professional] programmers, it is only one of several ways to "give orders" to a computer. In addition to it and Functional , we also have Logic Programming (ex.: Prolog), Dataflow (ex.: the internal engine of a spreadsheet), Function-Level (programs do not manipulate data, but other programs), etc. And, of course, the more conceptual/theoretical Turing Machine – to which all previous paradigms are computationally equivalent.

Each of these paradigms has its advantages and disadvantages, and it is common as programming languages ​​"evolve" that they incorporate aspects of the other paradigms. The main reason why one paradigm or another is used is its expressiveness : in principle, we could all be programming in Turing Machines, but in addition to the difficulty of reading/writing/understanding such programs, they would also be too extensive in relation to what make of useful. Likewise, different paradigms offer a greater degree of expressiveness for specific domains (even if the language as a whole is Turing-complete).

As for F# in particular, I'll quote an answer to a similar question on Stack Overflow in English:

My expectation is that F# will be used for parts/parts of some specialized systems – the parts that involve complex threading / math / financial calculations / modeling / etc, where F# fits well. In most other areas (UI, Data Access Layer, etc), a general purpose language like C# seems (in my opinion) preferable.

One of the advantages of F# is that (in theory) you can prove that the code is working, rather than just testing it. Threading support (thanks to immutability and the asynchronous use of ! ) is also good (although PLINQ can compete on threading ).

(Comment: I disagree with the author of this answer in the sense that it is possible to prove that an imperative program is correct – it just takes more work…)

I can't comment on our market, since I don't participate in the Microsoft "ecosystem" (I prefer to develop in free software), but in general, opening the minds of Brazilian programmers to functional programming I think would be very welcome!

Scroll to Top