Learn to program in F # | functional programming | Get programming with F# – A guide for .NET developer by Isaac Abraham

As an annual goal I had set out to learn programming in F#, the brother language of C#, because I had often heard about it while I was interested in the virtual actor model framework Microsoft Orleans.
I expected to be able to program very quickly, similar to when you learn React and already have knowledge of Angular, or Vue, and the like.
Unfortunately, I immediately ran into the lack of documentation, example projects, and guides from A to Z, such as – for example – on Pluralsight.
I was able to get some information here and there from sites like the official one Microsoft F#, or from the famous https://fsharpforfunandprofit.com by Scott Wlaschin, but little or nothing practical that would allow me to implement the classic WebApi with frontend.

I got lost in unheard terms like Monad, Monoids, Endofunctor, Currying, and many more.
I realized that all the patterns that I took for granted as “universal” actually weren’t. In functional programming, for example, Dependency Injection is not used! (but because it is not necessary).

At this point I realized that functional programming is not just a term, but a whole world. For example LINQ in C# has been implemented by taking concepts of functional programming, and adapted to object-oriented programming in C#, giving it unprecedented power, expressiveness and ease of reading.

And the recent introduction of C# pattern matching that allows you to have a complete management of all the cases of a set of values, which is fantastic, because it allows you to be 100% sure that you have covered all the possibilities of a combination. This allows you to have “safe” code, but not only for the time you write it, but also for the future in case the possible combinations change in the future.

Also the intrinsic approach of using – in practice – static functions, immutable functions, pure functions instead of stateful objects and side effects, it fits my way of thinking very well. Very in tune with how I write code, or how I’d like to write it.

So I realized that I needed a more “linear” support, which would take me from “A” to “Z”, so I looked for books on the subject. Unfortunately, even here, there are not many updated books.

So I focused on a book that would allow me to bring my knowledge of C#, into F#:
“Get programming with F # – A guide for .NET developer” by Isaac Abraham

I must say the book is very useful and achieves its purpose, i.e. it allowed me to understand how to “translate” the C# code into F#.
The book is done in modules and covers everything a beginner needs, introduces all the main concepts, and also the most common libraries on data access (CSV, JSON) but also on databases, WebApi and domain logic.
I didn’t really like the approach to the exercises, where it required you to write the code, which I wasn’t interested in doing, but just giving a read to grasp the main concepts. It would have been nice to have the code printed in the book, to understand what it was referring to.

It doesn’t talk about more advanced concepts, like Monad and Railway programming, and more “functional” patterns. A great book if you want to start managing an existing project in F#, or to start a new project, but still a hybrid between object oriented and functional programming.

Being more interested in a “total” approach to functional programming, and interested in “real” patterns, I am now reading the book “Stylish F# 6: Crafting Elegant Functional Code for .NET 6” by Kit Eason (2nd Edition)

The book is intermediate level and has a much more “rigorous” approach to functional programming, which I really like. Some concepts are explained very simply, and it has all the code of exercises and examples. I’m still at the beginning, but I’ll do a dedicated review of him in time.

Let me know if you have experience in F # or if you have interesting resources!

Add a Comment

Your email address will not be published. Required fields are marked *