FINDING LIKELY CANDIDATES FOR FUNCTIONAL PROGRAMMING

This is a question that users of Microsoft’s new F# language have to deal with all the time: where in your architecture are the places where it makes sense to use F#? Opinions on this vary wildly — some people think it should be restricted to certain science-intensive parts of the code, whereas others like to stress that F# is a general purpose programming language just like others on .NET. Questions of tooling are important in the area of F# as well, because Visual Studio support for things like UI designers isn’t available so far.

Shades of Grey

In C#, and perhaps in F#, the question really needs to be what disciplines to use for particular areas of your code, or how strictly to adhere to certain ideas. These considerations are not new, but perhaps more attention must be paid in these days of hybrid languages and programming environments.

In the past, a consideration might have been about typing. Generally, C# aims to be a strictly typed language, and with the advent of generics this focus became even more pronounced. Nevertheless, there are situations when it seems like a good idea to work with an untyped list of objects, perhaps as implemented by the ArrayList type. In .NET 4.0 times, this may overlap with scenarios where the use of dynamic programming features, or even direct interfacing with DLR (Dynamic Language Runtime) is considered.

With functional programming, you need to make similar decisions. Object orientation ...

Get Functional Programming in C#: Classic Programming Techniques for Modern Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.