Trying F# – are you a developer or a mouse?


Since starting to deliver my “Power of F#” talk to user groups and companies (generally well received – I hope), and getting involved in a few twitter debates on F#, I’ve noticed a few common themes regarding why .NET teams aren’t considering trying out F# to add to their development stack. Part of this is the usual spiel of misinformation of what F# is and is not (“it’s not a general purpose language”), but another part of it comes from a conservatism that really surprised me. That is, either: –

  • There’s no / limited Resharper / CodeRush support for F#. Ergo, I won’t be able to develop “effectively” in it
  • If I start learning it, no-one else in my team will know what I’m doing and so we can’t start using it

Now allow me to attempt to debunk these two statements.

Resharper (or CR) support is a non-issue for me. Personally, I use CodeRush over Resharper, but let’s be honest about what both of these are: Tools to speed up development time. Now, some of the issues that they solve aren’t as big an issue in F# as in C#. Perhaps the one I do miss the most is rename symbol, but others like Extract to Method aren’t as big a problem in F# due to the extremely lightweight syntax, type inference and the fact that it’s an expression-oriented language. So, it’d be nice to have some support in the language for refactorings, for sure – but it should absolutely not be a barrier to entry.

The “team training” issue is a more serious one to my mind, primarily because it’s about the individual’s perception of learning a new language rather than some arbitrary piece of tooling. Trust me when I say you can be productive in F# in just a few days if you’re coming from C# or VB .NET – particularly if you’ve used LINQ and have a reasonable understanding of it (and it’s constituent parts in C#3).  Cast your mind back to when people started adopting .NET from, say, VB6. Was there no training issue then? Or from C++? Learning F# is far easier – the whole framework is the same as C# – it’s just the plumbing that orchestrates your calls to the framework that look a little different.

There are certainly a number of features in F# which don’t really have direct equivalents in C#, and to get the most out of the language you’ll need to do a bit of learning to understand new concepts – just like, say, C#2 to C#3 . I would say that F# is in a sense a higher-level superset of C# – you can do pretty much everything you would in C# albeit in a different, terser syntax, plus a whole load of other bits and pieces which you can opt into as you get more comfortable with the language.

 

As developers, we need to remain open minded about the art of programming. It’s what allows us to use things like LINQ rather than simple for each loops. It’s also what allows us to say “yes, using white space to indicate scope instead of curly braces isn’t necessarily a bad thing” or “yes, the kewords ‘let’ and ‘do’ aren’t inherently evil in a programming language”. Keep an open mind and try something new – you might actually be pleasantly surprised!

Advertisements

3 thoughts on “Trying F# – are you a developer or a mouse?

  1. You forget a significant portion of the industry writing C# code does not use or understand LINQ outside of the comprehensive syntax which they have convinced themselves is just SQL in C#. C# 2 is still the de facto standard because of the conservatism you speak of. The .NET industry is still stuck demanding the Socially Acceptable Middling Effort, or SAME. LINQ is still something some won’t learn so for everyone to do the SAME many shops do not allow LINQ to be used. Next time you see such conservatism, maybe you need to widen your own perspective by asking them: “Do you use the where/any/all/etc functions on IEnumerables in C#?” (Many believe “LINQ” is an ORM and has nothing to do with those things, so asking of LINQ is not asking most the same thing as I stated). This conservatism is killing the best runtime in the industry and it’s depressing.

    1. Agree with nearly everything you’ve said regarding the state of the industry. I think LINQ over e.g. objects is becoming pretty standard nowadays – but there are many developers out there that don’t have a decent understanding of the internals of LINQ which IMHO is really, really important.

      Ironically it’s considered a “good thing” to learn more about C# e.g. the scenario which you have outlined re: LINQ, yet the same is not thought of about learning a new language like F#.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s