Lesson 36. Asynchronous workflows
The past few units have focused almost exclusively on libraries and frameworks that work with F#. This first lesson of the unit briefly hops back to the language side of things and introduces an important language feature in F# called asynchronous workflows, which allow you to orchestrate asynchronous and multithreaded code in a manageable way. These provide ways to parallelize code more easily, allowing you to create high-performing and scalable applications. You’ll see
- Why asynchronous programming is important
- What async workflows are
- A comparison of async programming in F# and C#
- Computation expressions in general
Although there’s a decent chance that you’re already aware of multithreading and asynchronous programming (especially if you’ve been working with C# 5), it’s worth quickly covering these terms and why they’re important for the web. I’m going to slightly simplify things by talking about synchronous and asynchronous work. The former represents work that happens in a single, sequential flow of execution—essentially, all the code you’ve written thus far. Asynchronous work represents the notion of doing work in the background, and when it completes, receiving notification that the background work has finished, before consuming the output and continuing.