Learn at least one new language every year.
Above is one of the best recommendations in my developer career. It is from the book, “The Pragmatic Programmer” by Andrew Hunt and David Thomas. The obvious advantage of learning a new language is to expand your problem solving skills as different programming languages usually have different styles and approaches to solve problems. To get the most benefit, I think we should not learn the new language that is too similar to the languages we already know (e.g., C# programmer learning Java).
Last summer I was having fun with the “Coding Dojo: a gentle introduction to Machine Learning with F#” by Mathias Brandewinder, so I decided to learn more about F#.
I also chose F# for the following reasons:
- F# is a “Functional-First” programming language unlike C# which is “Object-Oriented” first. You probably heard a lot of buzz around functional programming paradigm and why it matters especially since the free lunch is over.
- F# is one of .NET CLR languages, so interoperability with C# is easy. I can still use C# for many tasks that it is good at such as GUI programming (i.e., XAML for WinRT, Silverlight and WPF) while utilizing F# for other tasks that functional programming will shine.
- I can use my favorite IDE, Visual Studio. I also post about Visual Studio Extensions that make your F# development experience better.
- F# is also a scripting language, so you can use REPL such as fsi (that comes with Visual Studio) or use web interface on tryfsharp.org or even using .NET fiddle which now supports F#. REPL makes it easier to try and test your code interactively.
However, learning and mastering a new programming language can be daunting task as you already have to keep up with new technology for your day-time job.
Today, I will review the free F# e-book from Syncfusion, F# Succinctly by Robert Pickering. F# Succinctly has about 100 pages, so you should be able to finish it within a week easily. It starts with a good and concise introduction into functional and F# programming with a little bit of history. It also gives some idea about why F# is good for .NET developer and how it is different from other functional programming languages.
The book has been released for a while, so it’s based F# 2.0 and Visual Studio 2012. However, most samples in the books should still work besides FSharp Charting which you should follow the instructions how to set it up here instead
Like most F# programming books, the book introduces you to F# programming via REPL (fsi). It covers most of the F# programming basic that you should know include the followings:
- Pattern matching
- Type and Type inference
- Discriminated Unions
- Function composition
- Pipe operation (|>)
- Partial function
In the later chapters, you will also learn about Object-Oriented aspect in F# and learn why multiple programming paradigm support makes F# suitable to solve different kinds of problems. At the end, you will learn how you can use F# to create user interfaces or graphics and creating real-world web and non-web application using F#.
However, as the e-book is written while F# 3.0 was still being implemented, the book doesn’t cover great F# 3.0 features like Type-Providers or LINQ support. Also, the book talks about important functional programming concept like recursion and pattern matching, but it doesn’t cover advance concept like tail-recursion, higher-order function, computation expressions, or active patterns.
In conclusion, the book is a good introduction to F# for anyone (especially .NET developers) who is interested in functional programming and F#. It should be an easy read and ignite your interest into learning F# and functional programming.
By the way, If you are interested in learning more about F#, there are many books, wikis, resources, news, and so on. Although, F# is originated in Microsoft, it’s open source edition and can run on other platforms like iOS, android. The best of all, F# has great and passionate people and community behind it. It also helps that I live in Nashville, TN which has three F# MVPs together with strong functional programming and .NET communities.
NOTE: Although I have been playing with F# for a while now, I still learn a lot of things from the book like how F# supports Unicode. Can you guess what Thai value names below mean in English?
let หนึ่ง = 1 let สอง = 2 let สาม = หนึ่ง + สอง