Sunday, 8 October 2017

What are the advantages of F# over C#

I just stumbled upon this old Stack Overflow post of mine which has been deleted:

The main advantage of F# over C# is much lower development costs (once your developers are familiar with F#, which will probably only take a few weeks).

From my personal experience I would estimate the productivity boost (= drop in development cost) to be 2-10×. This is strongly dependent upon the application, of course. The best cases for F# are applications requiring dense algorithmics (i.e. hard problems) or DSL implementations. The worse cases for F# are primarily where other languages have better tooling, e.g. GUI designer, WSDL code generator.

I consulted for a London-based company in the finance sector for 15 months and, amongst other things:

  • Implemented in F# in 4 hours a feature that had been scheduled to take 3 months of development in C++.
  • Built in F# in 3 months a server with 100x higher throughput, 100x lower latency and 10x better scalability (number of simultaneous client connections) than their legacy C++.
  • They were training around a dozen F# developers when I left.

I am currently consulting for one of the world's largest insurance companies and my predecessor developed an entire pension quote calculator (typically scheduled to take 300-400 man days) entirely in F# in under 100 days with no prior F# experience at all. Performance is 10× better than the C++ that it replaces because the new code avoids unnecessary copying and exploits multicore parallelism. Part of my job here will be to give basic F# training to around 20 people and bring a few people up to expert level.