A refresher on Async


A bit late in the day, but here's a quick-and-simple demonstration of the fundamental difference between single-threaded, multi-threaded and asynchronous coding patterns. To illustrate this, here's a simple task that you've no doubt seen a million times before - download a number of resources over HTTP. The code for this demo is available in both … Continue reading A refresher on Async

Advertisements

Lightweight callsite caching with F# and C#


What is Memoization? Just a simple demo outlining how you might write a simple generic callsite cache in F# aka Memoize. This is something that you can find elsewhere on the web - it's easy to write one. What I really want to illustrate is if you were to write something similar in C# how … Continue reading Lightweight callsite caching with F# and C#

Modelling problem domains in C# and F# – Part 2


In my last post, I illustrated how we could model a simple real-world problem using classic OO concepts such as type hierarchies, interfaces and stateful objects. In this post I want to contrast that with a functional-first approach using F#. Discriminated Unions In order to model the different types of Positions on a Monopoly board … Continue reading Modelling problem domains in C# and F# – Part 2

Modelling problem domains in C# and F# – Part 1


I’m trying more and more to use F# for hobby projects etc. and finding, as usual, that there are very elegant, lightweight solutions to abstractions. This time: Monopoly. Defining a Problem Space A while ago I did something fairly simple in C# to simulate the Monopoly board that rolls two dice, moves a player on … Continue reading Modelling problem domains in C# and F# – Part 1