F# Webcast (IV.) - Developing standard .NET libraries
In the previous parts of this webcast series we've developed an F# script that downloads RSS feeds
asynchronously and in parallel and searches them for the specified keywords. We followed the usual F#
development style, so after introducing the basic functional
concepts, we wrote the code in the simples possible style
and demonstrated how to use System.Xml
and System.Net
namespaces. Then we
refactored the existing code, to run asynchronously and process
the results potentially in parallel, which was very easy thanks to F# asynchronous workflows.
In this part of the series, we'll make the next evolutionary step of our sample application. We'll turn the code that originally used F# tuples and lists into code that uses standard .NET objects and we'll also see how to declare a class in F#. This simple modification will turn the script into an F# library that is almost indistinguishable from a library developed in C#. We'll also look how you can use the library from C# web application to show the interop between C# and F# in practice. We'll start with the code from the previous part, so if you missed that, you may want to check it out or download the source code.
F# Webcast Series
This webcast series follows the usual F# development process where you start with experimenting and writing an initial version of the solution interactively using the F# interactive tool. In the later phase of the process, we modify the code to make it parallel and asynchronous and finally, we can also encapsulate it into a standard .NET library that's usable from C#. Here is a list of all webcasts in the series:
- Part I. - Introducing functional concepts
The first part introduces functional programming principles such as immutability, recursion and functions that take other functions as parameter (higher order functions). This can all be demonstrated in C# 3.0, so we start with C# and then look how the same concepts look in F#. Finally, the first part also shows functions for working with lists in F#. - Part II. - Using standard .NET libraries
The second part demonstrates how we can use standard .NET libraries. It uses classes fromSystem.Net
andSystem.Xml
to download content of a web page (RSS feed), load it into XML document and process it to find only posts that contain some specified keyword. - Part III. - Downloading web pages asynchronously
The third part shows how to make the code from the part II. better. It introduces F# asynchronous workflows that can be used for writing code that doesn't block a thread when waiting for the completion of some I/O request. This part also shows how to modify the code to download and process multiple feeds in parallel. - Part IV. - Developing standard .NET libraries
In the fourth part, we look how to encapuslate the functionality written in F# into classes. We'll finally create a project (rather than just use F# scripts) and we'll wrap the code we wrote into a .NET class. We'll also look how to compile the project into DLL and how to use it from a simple C# web application.
Downloads
- Source code from the webcast (ZIP, 9kb)
- Download the video (WMV format, 32.8MB)
- Microsoft Visual Studio 2010 First Look - Microsoft.Com
- Visual Studio 2010 Beta1 with F# is now available, plus matching F# CTP Update for VS2008 - Don Syme's WebLog
- F# May CTP for Visual Studio 2008 - Microsoft Downloads
- Microsoft F# PowerPack for .NET 4.0 Beta1 - Microsoft Downloads
Published: Monday, 15 June 2009, 8:09 PM
Author: Tomas Petricek
Typos: Send me a pull request!
Tags: functional, asynchronous, webcast, f#