Though I have posted a few times on some of the awesome things F# can do for your code, that doesn’t necessarily mean it’s always good choice for each of your applications. You may look at the code features and and some sample code and think This is great, but I can’t see this being used other than in finance or data science projects. True, F# may be used fairly heavily in those areas, but I’d like to argue that it can be quite useful in enterprise applications, as well.
Lena, a fellow F# developer, has a very thought provoking article talking about F# in the enterprise especially when talking to decision makers at companies. I figured I’d expand on Lena’s post and offer my own thoughts to using F# in the enterprise.
The main thing about F#, that I’ve found, is that people often ask I like it, but where can I use it in my day-to-day development? Well, hopefully the below list will help out a lot and may even cause you to rethink what all F# can do for you.
Mobile applications are probably not exactly the first thing you’d think when you hear F#, is it? But it’s true. The awesome folks at Xamarin made F# into a supported language and it can be used to create Android, iOS, and Windows Phone applications.
Even though F# is functional first, it can definitely be used to write Object Oriented applications like these.
There is definitely more awesome stuff to come from Xamarin in terms of F#. There will be more F# templates and it will soon be easier to use Xamarin Forms with F#.
Wouldn’t it be awesome to just be able to enclose your code to run on the cloud like this?
// Code to execute on the cloud servers
Well, with MBrace you can do that!
To see a demo of it in action, check out the below video from dotNetConf. I recommend the whole video but the MBrace awesomeness is around 33 minutes.
While I will always suggest trying out F# for the data access layer in any application because of how awesome type providers are, the language actually has quite a few frameworks and libraries to help with your enterprise web application development.
Suave is a fairly new F# library for a lightweight, non-blocking web server. Not only that, it’s fairly easy to get started. From their documentation, it only requires just a couple of lines, including opening namespaces, to get a very simple web server going.
open Suave // always open suave
open Suave.Http.Successful // for OK-result
open Suave.Web // for config
startWebServer defaultConfig (OK "Hello World!")
Of course, since F# is a CLR language it can still be used with straight ASP.NET. There is even an extension where you can have your MVC project all in F#.
I believe one of the best ways to incorporate F# into the enterprise is to use FAKE to create your build scripts.
Even Scott Hanselman has a post about using FAKE and Suave to deploy to Azure.
While NuGet does do a good job managing third-party assemblies, there is a fairly new way to do this and, honestly, I prefer this better. Paket still uses NuGet, but Paket can also reference GitHub or Gist dependencies as well as HTTP dependencies.
I hope this helped shed some light in some ways F# can benefit your enterprise applications. Look forward to future posts that go into some more detail in several of the ideas presented.