It’s been a while since I finished Get Programming with F# by Isaac Abraham but I haven’t come around to review it, until now.
Learning functional programming has been one of my personal goals this year. I started out with Functional Programming in C# by Enrico Buonanno which explains a lot of the concepts of functional programming, and shows how they can be implemented in C# (see my review here https://ericbackhage.net/c/book-review-functional-programming-in-c/). It was nice to be able to learn the concepts without needing to pick up a new programming language at the same time. However, since C# is primarily an object oriented language, things like immutability, partial application, currying, etc does not fit very well and does not come naturally. So what better way to get some real experience than to learn a functional first language?
There are several languages to choose from when you wish to pick up a functional language. For the purist there is Haskell (https://www.haskell.org/) which is a purely functional programming language. If you wish to run on the JVM you can give Scala (https://scala-lang.org/) or Clojure (https://clojure.org/) a go. For me, who primarily writes code that runs on the CLR, F# felt like a natural language to start out with. Any libraries that you write in F# can be used from C# projects as well, and you can have both C# and F# projects in the same solution in Visual Studio and have them reference each other. Hence, I decided to Get Programming with F#.
The subtitle of the book is A guide for .NET developers and that is exactly the target audience. I would say that a prerequisite for getting real value from this book is that you are familiar with writing code in C# using Visual Studio.
It is written similar to a hands-on tutorial where new material is presented and you are given tasks where you need to apply the knowledge. I like the idea where you follow along and put your new found knowledge into practice as you go, but it also put constraints on when and where you can study the material since you need to sit by your computer pretty much the whole time.
The book was published in 2018 and most of the material is still relevant. However, there are some parts that are out of date, especially those that describes how to set up your work environment for working efficiently with F#. This is quite frustrating since this is one of the first things you encounter in the book and it does give you a bad start. Once you realize that Visual F# Power Tools is no longer supported and either just move along without it, or switch to Visual Studio Code with Ionide (https://ionide.io/), everything goes pretty well, until you need to reference libraries from F# interactive. I struggled with this quite a bit and ended up using nuget on command line to download the packages to a temporary folder which I then referenced. If you know of a better way, please let me know.
The material covered is all good stuff. I was very impressed with the type providers and I can see how these can be very powerful tools. Even though F# is a multi-paradigm language the author focuses on the functional style and avoids using object oriented solutions. This is a good thing since it shows how to solve common problems in a different way than you are used to, coming from C#.
I am not aware of any other book on F# that is quite like this one and I would recommend it to anyone with a solid background in C# development that wish to get some hands on experience with functional programming in F#. It is a bit frustrating that some parts are out of date but if you are aware of it you can quite easily just skip those parts. Also, the code for the book could use some updating, there is however a separate branch for .NET Core that I recommend you switch to when working through the examples (https://github.com/isaacabraham/get-programming-fsharp/tree/netcore).
If you really want to go hardcore I believe Haskell is the way to go. F# is not purely functional and will let you do things, like calling impure functions from pure functions, that won’t even compile when using Haskell. I do however recommend that you try to adhere to functional principles also when learning F#. If you want to write code using object oriented principles then C# is a much better fit.
In summary, if you are a C# developer interested in F#, this book is for you.