
This video gives an overview of entire course.
Setting up F# is different in VS 2017 than in earlier versions. This video shows how to get the tools ready.
Install F# tools from Visual Studio Setup program
Create F# projects and test code in interactive window
Subscribe to get new features in F# nightly builds
VS Code is fast, free, and cross platform, but using F# is quite different from Visual Studio. This video shows how to install and use the Ionide F# tools.
Install Ionide extensions
Create F# files and folders
Use the F# features in editor and interactive window
VS Code and Ionide rely on open source FAKE and Paket tools to make projects compile into assemblies. The experience is very different from Visual Studio, but this video shows how to do it.
Use Ionide to create F# project files
Use Paket to manage packages and FAKE to build assemblies
Add a reference to a project from another project
This video shows how to write and run unit tests in F# in Visual Studio using MSTest, NUnit, and XUnit.
Install MSBuild and create unit tests
Install NUnit and create unit tests
Install XUnit and create unit tests
You can write better tests faster if you use functional testing libraries designed just for F#. This video shows how to do that.
Install FSUnit. Extra work needed because of Nuget package dependencies
Install Unquote and use its unique assertion syntax
Compare advantages of FSUnit and UnQuote
In this video, we will understand why IDTs are preferred over classes for functional programming. Know when to use each type of IDT.
Understand what IDTs have in common
Understand when to use tuples and records
Understand when to use discriminated unions and options
In this video, we will use the five types of collections in F# to model groups of objects and also will understand when and how to use each type.
Learn the common features of the five collection types, and the special features of each
Instantiate and use the sequential collection types –Array, List, and Seq
Instantiate and use the hash table collection types – Set and Map
In this video, we will compose your application out of small, easily testable parts avoiding bloat.
Understand the syntax for writing functions, and what a function’s type declaration means
Use F#’s power to return functions from functions and to take functions as arguments to other functions
Review how and when to use anonymous functions
In this video, we will leverage the ready-made collection functions in F# to do complex processing on large amounts of data without writing a lot of code.
Use query functions to efficiently extract information from collections efficiently
Generate new collections from existing ones with Map, Filter, and Rev functions
Calculate complex results with Fold and Reduce functions
In this video, we will see how to make functional F# programs interoperate with programs written in non-functional, object-oriented .NET languages like C#.
Consume C# class libraries in F#
Expose F# modules and functions to C#
Expose F# IDTs to C# and understand the limitations
In this video, we will see how to accurately model and implement the required behavior to design good software. Object-oriented approaches to design often focus on data before behavior. But the functional features of F# and its interactive prototyping, let you model and implement behavior from the beginning.
Represent the required behavior with F# functions
Declare types for the arguments and return values of functions
Elaborate your types as you discover what data they need
F# units of measure turn numeric values into domain-specific types. In this video, we will see that with UoMs you can easily tell what a numeric value represents in the real world. Even better, a UoM can only be used for correct purposes in calculations.
Discover what UoMs are required by your domain
Declare UoMs for numeric types
Implement transformations between UoM types, if necessary
Whereas UoMs are for numbers. In this video, we will see that how single-valued unions let you turn any .NET type – including strings, DataTimes, and bools into a domain-specific type. SCUs make clear what a value means in the real world, and what things it can be used for.
Understand the benefits of single-case discriminated unions (SCUs)
Declare SCUs from built-in .NET types
Learn how to extract the value from a SCU
Bugs won’t happen at runtime if they keep the program from compiling. In this video, we’ll see how to use F#’s type system to make invalid runtime conditions unrepresentable.
Use F# types to model valid states only
Use functions to allow only valid state transitions
Encapsulate object creation behind F# modules
A pure function is one with no side effects. This video will show how to use pure functions to improve both the expressiveness and safety of your code.
Understand why pure functions make code more expressive and safe
Learn to recognize when a function is impure
Learn techniques to make functions pure and avoid impurity
Dependency injection is a common way to make code more extensible and testable. In object oriented languages, dependency injection is usually implemented with interfaces. In this video, we will see how F# lets you implement dependency injection easily and with less ceremony by using higher order functions.
Compare dependency injection using interfaces with F#’s higher order functions
Understand why functions used in dependency injection should be pure
Use function type definitions to define what behavior to inject
Sometimes all the data a function needs isn’t available at once. This video shows how classes are often used in object oriented programming to solve this problem, and F# partial functions are a more straightforward solution.
Use partial functions to capture available arguments while deferring others
Understand the effect of tuple arguments on partial function construction
Arrange the order of arguments to facilitate partial function application
In OOP, it’s often easier for an object to call its own methods than to call methods on other objects. This encourages creating large bloated classes. In this video, will see that F# functions can call other functions easily. , And that’s why complex behaviors can be composed out of the simpler behavior of individual functions.
Use the |> and >> operators for function composition
Understand why functions used in composition should be pure
Understand the effect of tuple arguments on function composition
In OOP, it’s easy to define a class’s data, but more difficult to enforce data validity rules, and still more difficult to enforce state transition rules. In this video, we will see how with F# it’s easy to define state transitions, even before you define all the data for each state.
Learn the data and function patterns for state transitions
Use functions to define state transition rules
Define the data types that represent each state
This video gives an overview of the entire course.
In this video, we will plan the steps in data processing, including data acquisition, transformation, and error handling.
Using this approach, we will design a process to convert data from a CSV file into F# records.
Use the .NET framework to input and output data
Explore the data in F# interactive window
Convert raw data to static types
Sequences are the most flexible way to create data streams in F#.In order to use them effectively, understand the IE numerable interface on which they’re based. In this video, we will write F# sequence expressions to generate sequences using complex logic, including recursion and management of external resources.
Learn the syntax for writing sequence expressions
Create a sequence expression that calls itself recursively
Create a sequence that manages access to an external resource
Working with data collections often requires joining separate collections together, splitting them apart, and dividing their elements into subgroups. In this video you can achieve this easily with functions in the collection APIs.
Join collections sequentially with append and collect functions
Merge and split collections with zip, zip3, unzip, and unzip3 functions
Divide collections into groups with pairwise, windowed, and groupby functions
In this video, we will measure the performance of your data processing code. To improve efficiency, you can use these techniques to eliminate unneeded and/or redundant steps, postpone actions until they’re needed, and avoid copying data. Use tail recursion to make recursive functions as fast and avoid stack overflow.
Measure execution time in F# interactive and with functions
Compute efficiently with lazy sequences, preloaded data and “memo-ized” data
Prevent stack overflow with tail recursion
In this video, we will make use of parsers and combinators to build programs that read complex, hierarchical data formats. You will learn to leverage FParsec, a popular, mature, open source parser library.
Parse simple inputs with FParsec parsers
Use FParsec to extract data from a CSV file
Handle nested hierarchies of data in a CSV file
This video helps to understand that asynchronous programming lets you move slow operations onto background threads. You need to decide if asynchronous programming will benefit your application. If so, F# asynchronous workflows are an easy, intuitive way to write asynchronous code that resembles synchronous code.
Identify blocking operations and decide if asynchronous programming can help
Write an asynchronous workflow to run slow tasks in parallel
Measure your asynchronous workflow’s performance and compare to synchronous code
This video tells that although the syntax for writing asynchronous workflows is fairly easy, there are some subtleties in the different ways to start and control them. A good understanding of the functions in F#’s Async module is important.
Hook up asynchronous workflows with the .NET task parallel library
Use cancellation tokens to cancel running workflows
Use continuation functions to handle success, exceptions, and cancellations
F# agents give you an asynchronous program model with three important advantages: first, agents can keep private, isolated, and state; second, agents respond to messages in FIFO order; and third, agents are lightweight, and you can run thousands at a time.
Create and send messages to an F# agent
Implement a state machine inside an agent
Scale an operation by having agents create other agents
The observer pattern allows “observable” publishers to send messages to arbitrarily many subscribers. The publisher can send messages often or infrequently, and at regular or irregular intervals. The reactive extensions for F# are an open source project that makes it easy to write observable publishers, and to consume streams of messages using syntax similar to the collection APIs and/or to LINQ.
Use observable expressions to publish messages
Subscribe to and transform messages with observable module functions
Subscribe to and transform messages with rxquery expressions
Data is erupting so fast now that techniques for turning data into actionable code are increasingly important. This video explains that F# type providers are one such technique.
Understand how F# type providers turn data into code
Learn two ways to get FSharp.Data from Nuget
Try a simple HTML type provider
This video explains the most famous type provider which is probably the one Microsoft built on top of Linq-to-SQL for SQL server. It is an impressively complete data access layer, yet it does not generate or compile source code. Instead, it “compiles” the database schema into F# types.
Build a type provider out of a SQL database
Write F# query expressions to control a relational database
Use the SQL type provider to update rows in tables
This video explains that web APIs can expose metadata, but they can’t force clients to comply with it. F# type providers read metadata and compile it into statically type-checked client code, so the code enforces the API’s metadata.
Why type providers are well suited for writing Web API clients
Explore the World Bank type provider
Explore the JSON type provider
This video helps us understand that type providers are helpful in programs that will handle large sets of data. The extra correctness from static type checking helps assure that data is used carefully and correctly. The Azure storage type provider gives safe control over the management of resources in Azure storage accounts.
Open and read a file in Azure blob storage
Upload a file into blob storage
Query data in an Azure storage table
Developers are challenged today to build applications in less time, while maintaining high standards of quality, reliability, security, and performance. The F# programming language can help you meet these challenges by letting you write solutions with less code, fewer bugs, and better alignment with business requirements.
This course follows practical approach, where initially you will setting up our F# development & then look in depth at two powerful techniques for building real-world F# applications: type-first design and function composition. We'll then learn to leverage advanced F# tools to build and test applications. Then you will learn how to set up a development environment and design a build process with tools that leverage the F# language.Finally you learn, how to process large sets of data with maximal performance and efficiency using asynchronous workflows, agents, and .NET reactive extensions.
Contents and Overview
This training program includes 3 complete courses, carefully chosen to give you the most comprehensive training possible.
The first course, Building F# Applications starts by showing how to use the functional features of F# to rapidly turn requirements into software designs that are correct, complete, extensible, bug-free, and easy to read and understand. We will start by setting up our F# development environment and reviewing some key language features. We'll then look in depth at two powerful techniques for building real-world F# applications: type-first design and function composition. We'll then learn to leverage advanced F# tools to build and test applications.The video course examines key language features and functional programming techniques with the goal of providing a good understanding of the basic building blocks that can be used to build higher abstractions and more comprehensive solutions. As we go, we will learn how to set up a development environment and design a build process with tools that leverage the F# language.
The second course, Data Programming with F# presents practical techniques for handling real-world data programming challenges. We'll first see how to build efficient, extensible engines to parse and process documents and data streams. Then we'll study how to process large sets of data with maximal performance and efficiency using asynchronous workflows, agents, and .NET reactive extensions. Next, we'll learn to use type providers, a unique F# feature that lets us program with data as if it were code. By the end of the course, you will be capable of writing solutions with less code, fewer bugs, and better alignment with business requirements.
About the Authors
Richard Broida is a software design and programming consultant specializing in Microsoft Windows and Azure technologies. Over his career he has developed enterprise applications for clients in medical, banking, insurance, manufacturing, transportation, and e-commerce. He is a frequent speaker on F#, C#, and cloud technologies and has taught .NET programming courses for adult professionals.