Day 1
Basics of Functional Programming, F# syntax, types and functions
Functional Programming is not a new discipline, but in the context of modern application development it is interesting for particular reasons. In this module we will shed some light on those reasons, and what it means to use functional approaches, either instead of or in conjunction with object oriented techniques. Next, we will have a look at the syntax used by the F# language and the special types it comes with, and we will create simple functions for the first time.
Advanced functions and functional techniques
This module introduces advanced functions ‐ recursive functions, lambda expressions and nested functions ‐ and then moves on to investigate common techniques used to make functions into building blocks, from which new functionality can be created. F# uses curried functions by default and there are special operators that pipe calls or use composition as a means of function construction. We will see how to use these features together with closures and partial application to implement functional precomputation and memoization.
Discriminated Unions
An advanced data type, discriminated unions solve many of the same problems that class hierarchies are created for in the pure OO world. In fact, the F# compiler creates class hierarchies automatically out of these constructs, while the nested and recursive structures are easy to create and evaluate from functional code. They can form the basis of complex data structures, and this module demonstrates both a linked list and a binary tree implementation as examples.
Day 2
Exception handling, types and casting, and an introduction to sequences
An easy start into the second day, this module ties up some loose ends first by looking at the important plumbing topics of exception handling, working with IDisposable, checking, casting and converting types. Then we have a quick recap of arrays and lists before introducing a more advanced, continuation-based list type, the sequence. We investigate the list comprehensions supported by F# for all list types.
Map, Filter and Fold ‐ standard higher order functions
With equivalents in many programming languages, map, filter and fold are the pillars of algorithmic work in the functional world. Used in the Google MapReduce API, they can also form the basis of the all-important scalability improvements that functional programming promises. We look at use cases both in the area of data handling and querying and calculation algorithms.
Object Oriented Programming Part 1 ‐ Immutable classes
Working with immutable data is an important theme throughout functional programming theory, and in F# it stretches to the way object oriented programming is supported by the language. There are also advanced techniques of OOP available in F#, which allow for the creation of object interface types, the use of inline object creation expressions and the application of composition over inheritance.
Object Oriented Programming Part 2 ‐ Mutable classes
As a .NET programming language, F# needs to support all the mechanisms of implementation inheritance that are needed to create class hierarchies like those in the .NET framework, which are fully compatible with other .NET languages as well as mechanisms like data binding. This final module shows how to derive classes from abstract base classes, overload and override methods, implement read/write properties and indexer properties, and use accessibility modifiers to hide implementation details.