Chapter 13. Asynchronous and data-driven programming

 

This chapter covers

  • Programming asynchronous workflows
  • Exploring data using F# Interactive
  • Defining meaning of types using units of measure
  • Processing and visualizing data

We’ll begin with a quote from an interview with Bill Gates in which he talks about the type of programming tasks that he’s interested in and describes the typical scenario when writing the application:

Go grab data from the web, don’t just think of it as text, bring structure into it and then [...] try out different ways of presenting it, but very interactively. [...] Write a little bit of code that may have your specific algorithm for processing that data. [Gates, 2008]

This describes exactly what we’re going to do in this chapter, and as you’ll see, the F# language and its interactive shell are excellent tools for solving this kind of task. We’ll call this approach explorative programming, because the goal is to explore a massive amount of data and find a way to gather useful information from it. We’ll spend most of the chapter working with F# Interactive, because it gives us a great way to “write a little bit of code” with our “specific algorithm for processing that data” and immediately execute it to see the results.

13.1. Asynchronous workflows

13.1.1. Why do asynchronous workflows matter?

13.1.2. Downloading web pages asynchronously

13.1.3. Understanding how workflows work

13.1.4. Creating primitive workflows

13.2. Connecting to the World Bank

13.2.1. Accessing the World Bank data

13.2.2. Recovering from failures

13.3. Exploring and obtaining the data

13.3.1. Implementing XML helper functions

13.3.2. Extracting region codes

13.3.3. Obtaining the indicators

13.4. Gathering information from the data

13.4.1. Reading values

13.4.2. Formatting data using units of measure

13.4.3. Gathering statistics about regions

13.5. Visualizing data using Excel

13.5.1. Writing data to Excel

13.5.2. Displaying data in an Excel chart

13.6. Summary