Up and Running with F#

Level 200



This course explores the F# programming language and ecosystem to students who are familiar with the .NET framework and are already users of C# or VB .NET. The course will begin by introducing users to F# and Functional Programming in general, dealing with the “why” and “where”. Students will work through a number of code-first scenarios using Visual Studio 2015 that will give the student a firm understanding in the fundamentals of the language and Visual Studio tooling, as well as the confidence to explore more of the language themselves. Labs will be intermixed with examples and use-cases for solving problems using F#.

Module 1 – Introduction to F#

This module provides an introduction to F#. Topics include a brief overview of the history of the language, what problems it is designed to solve, where it fits in within the Visual Studio / .NET ecosystem, as well as a summary of the F# community and its ethos.

In this exercise you will download and install Visual Studio 2015 Community Edition.

Module 2 – Developing F# in Visual Studio 2015

This module focuses on configuring Visual Studio for optimum F# development. Students will also gain an introduction to writing code with the Visual Studio F# REPL, known as F# Interactive (FSI) and execute some simple F# examples.

In this exercise you will install and configure F# Power Tools.

Module 3: F# Fundamentals

This module will introduce the student to the most important F# language features that underpin many of the higher-level features in the language and framework, as well as explaining some of the key design decisions behind the F# language.

In this lab session, you will explore write a simple Web Browser application in F#. You will gain a practical understanding of how to use values and functions as well as seeing how the F# type inference engine in action.

Module 4: Functions and Data

This module will introduce the student to some of the core types in F# and compare & contrast them with equivalents available in the Base Class Library (BCL) and C# / VB .NET.

In this lab session, you will create a Calculator to perform some basic function. In the session, you’ll gain practical experience of using Tuples, Records, Functions and Modules, whilst also seeing how we can manage state using immutable data.

Module 5: Program Flow

This module will demonstrate common mechanisms for orchestrating program flow in F#. It also introduces the user to the last “core F# type”, the Discriminated Union.

In this lab session, you will model a simplified form of the popular board game Monopoly, using a combination of the tuples, records, discriminated unions and options.

Module 6: Collections

Collections are a core part of F#. This module will provide an overview of the various collections available in F# and compare & contrast them with equivalent types available in the Base Class Library (BCL) and C# / VB .NET.

In this lab session, you will perform a number of analytical queries over a dataset sourced from a flat file.

Module 7: Integrating F# and C# projects

Description: As a first-class citizen on the .NET platform, F# has an excellent interoperability story with C# and VB .NET. This module illustrates how interoperability is achieved between F# and C# and VB .NET, both in terms of consuming other .NET code and exposing F# to other .NET consumers.

In this lab session, you will explore an application that has a WPF front-end written in C# with its logic developed in F#. The application plays a more complex version of Monopoly than you observed earlier in this course, and allows the user to play a number of moves on one at a time, or in a burst fashion. It also tracks the number of times that the player has landed on any given position.

Module 8: Exploring data using F# and Type Providers

F# has rich support for accessing data with a wide variety of Type Providers, which provide the ease-of-use of a dynamic language such as Python with the type safety of a static language such as C#. This module illustrates some common patterns and core packages for accessing data.

In this lab session, you will create an API that can check two providers for weather forecasts for a given US City and State. To do this we will use a number of type providers to quickly and easily build up a set of services that we can compose together.

Module 9: Building Data-Driven Web APIs in F#

F# plays well with frameworks like Web API and can integrate with SQL through a number of mechanisms, including standard .NET APIs as well as F#-specific ones. In this session, we’ll illustrate the different mechanisms available to the user and build an API that exposes data over HTTP with a SQL backend.

In this lab session, you will create a local SQL database, populate it with a dataset sourced from the internet, before writing a simple data access layer and exposing the data over a HTTP-enabled API.

Module 10: Unit Testing in F#

You can write unit tests with F# just like you can with C#; because of the way that many F# functions are written, they are often easier to test than OO-equivalents. This module illustrates how to integrate your F# code with some of the unit testing frameworks that are out there.

Module 11: Wrapping up

This module will provide the student with some excellent resources and common F# packages worth investigating further.