Skip to content

niontrix/fsharpdaybyday

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

F# Day by Day

This repository is dedicated to teaching the F# language in tiny increments. The idea is you come back to the repo every day for a small dose of Functional Programming (FP).

At least we found that's the best way to learn a new language like F#. In fact this repository is testimony to this approach, because we wrote the articles and samples while we dug into the language for (almost) the first time ourselves. Whatever we learned and found interesting we logged here for you to follow in our footsteps for a couple of weeks.

Why learn F#?

What F# is, is best said by its current "owner", the F# Foundation at fsharp.org:

F# is a mature, open source, cross-platform, functional-first programming language. It empowers users and organizations to tackle complex computing problems with simple, maintainable and robust code.

Whereas "functional-first" means, F# is not purely functional, but also imperative and object-oriented. It's a hybrid or multi-paradigm language. It favors pragmatism over fundamentalism - and strives to make the transition for mono-paradigm language developers into the FP-world easier.

If this does not provide enough motivation for you to learn F#, get some inspiration from "Why am I so enthusiastic about F#" by Scott Wlaschin or his article series "Why use F#?".

F# currently is available for the .NET/Mono platform, which means it can not only be used on Windows, but also on Linux and Mac OS. It was originally developed by Microsoft's Don Syme, but since then has been made open source.

There are many resources on F# available for the curious. fsharp.org has compiled many fine books and articles and provides guidance for setting up F# on your computer.

Even F# coding environments exist online. Check out

If you don't yet want to clutter your hard disk/desktop with another IDE you can follow along the daily F# snippets with one of the above lightweight REPL environments.

More motivation needed?

If you're technically inclined you might be satisfied with the above pitch for why it's worthwhile to get to know F#. But what about your boss? Does she care?

Fortunately there is a business side to all those buzzwords. Choosing F# over for example C# or VB is a matter of economics.

Yes, it's economically prudent to switch to F#, the more so if you're already programming for the .NET platform. The reason is simple: evolvability and productivity.

Writing code in F# produces less lines of code (LOC). F# is a very terse language compared to C#, Java or C++. And less lines of code mean less to read, easier understanding, and usually less effort to change. Some even report an order of magnitude of LOC reduction after switching from an OO language to F#.

In addition F# code is (or at least can be) much more expressive with regard to your data. It's easy to map your domain language into code. This further enhances understanding.

And finally it is much easier to adhere to clean code principles and patterns with F#. Some of them are just workarounds for problems with mainstream object-orientation, so they don't apply. Some of them, on the other hand, can be translated more straightforwardly from design into code.

So even if you're not interested in lofty discussions about the merits of Functional Programming, even if you don't care about the benefits of immutability for concurrent programming... even then you should give F# a try. Because it's a language to please your customers with. They might not understand nor see F# code. But they sure will love if you're quicker to adapt your code base to new requirements.

What you will learn

There are quite some books on F# out there (see here for a list). Also you can find free introductions to the language on the Internet (e.g. see here or here). So why yet another explanation? It's because of your always scarce time.

This introduction is tailored to a busy schedule. It does not expect you to find extensive time to sit down and learn the details of a new language of unknown value to you. Instead it offers you a curriculum consisting of bite sized pieces in a clear order. Easy to digest in 10-15 minutes each day. No strings attached. You don't even have to code along. Take it as a form of "literate programming" for we've included a couple of examples to apply F# features to to solve "real" problems.

The focus is on small and pragmatic rather than comprehensive. What is presented each day is a tiny increment of easy to understand stuff. It builds on one another little by little. And it's accompanied or even driven by immediate application to programming problems. That way you learn what you need and what is easy to remember because it's relevant.

In the end it's just an introduction to F#. Don't expect deep dives and esoteric discussions of intricacies of the Functional Programming paradigm. Don't wait for a systematic discussion of languages aspects. The approach is much more natural, more childlike learning than adult learning.

F# is a fun language and so should an introduction to it be: fun and easy to follow along.

Of course, to get most out of it you should start practicing F#. But in the end you'll outgrow this introduction. You'll then want to switch to advanced literature. That's perfectly fine, no, it's even the purpose of this introduction.

And now, without further ado, enter into the realm of F# on day #1.


Follow this tutorial on our Twitter account @ccd_school; tweets will be marked with #fsharpdaybyday.


Thanks to Niklas Bergius and Carsten König for their reviews, suggestions, and corrections.


This introductory training for F# is brought to you by the Clean Code Developer School, Germany. We also founded the German Clean Code Developer community in 2009 with currently 4000+ members and have been teaching principles and practices for clean coding and fluent software production since then to many hundred developers.

About

Learn F# in tiny increments

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • F# 93.9%
  • C# 6.1%