Writing efficient and reliable code with F# Type Providers

F# type providers are just awesome because they help to write very efficient and reliable code.

In this post I will show this by implementing a simple, but real-world-like scenario with some F# type providers.

Type providers provide the types, properties and methods to get access to external data sources of various kinds without having to write a lot of boiler-plate code. This makes coding very efficient.

Additionally they offer static types that represent external data and that the compiler will check at compile time. This makes coding very reliable.

So let's look at the scenario that we are going to implement...
Continue reading →

Template Method Pattern. Can we do better?

Often we encounter algorithms with a certain structure that consist of individual steps that may vary for specific implementations.

To keep things clean and in order to reduce duplicate code we should refactor common parts out.

The object-oriented solution to this is the Template Method design pattern.

But there might be an alternative, better solution to this that uses higher-order functions.
Continue reading →