You can stack some monads in such a way that the composition is also a monad. This article is part of a series of articles about functor relationships. In a previous article you learned that nested functors form a functor. You may have wondered if monads compose in the same way. … | Continue reading
The answer is traverse. It's always traverse. I recently came across a Stack Overflow question about collecting and handling sum types (AKA discriminated unions or, in this case, result types). While the question was tagged functional-programming, the overall structure of the cod … | Continue reading
How to convert a list of tasks into an asynchronous list, and similar problems. This article is part of a series of articles about functor relationships. In a previous article you learned about natural transformations, and then how functors compose. You can skip several of them i … | Continue reading
Are Haskell IDE plugins now good enough that you don't need explicit type annotations? More than three years ago, I published a small article series to document that I'd changed my mind on various small practices. Belatedly, here comes a fourth article, which, frankly, is a cousi … | Continue reading
A functor nested within another functor forms a functor. With examples in C# and another language. This article is part of a series of articles about functor relationships. In this one you'll learn about a universal composition of functors. In short, if you have one functor neste … | Continue reading
A translation of the kata, and my first attempt at it. In early 2013 Richard Dalton published an article about legacy code katas. The idea is to present a piece of 'legacy code' that you have to somehow refactor or improve. Of course, in order to make the exercise manageable, it' … | Continue reading
A choice of two or more functors gives rise to a functor. An article for object-oriented programmers. This article is part of a series of articles about functor relationships. In this one you'll learn about a universal composition of functors. In short, if you have a sum type of … | Continue reading
Package a constant value, but make it look like a functor. An article for object-oriented programmers. This article is an instalment in an article series about functors. In previous articles, you've learned about useful functors such as Maybe and Either. You've also seen at least … | Continue reading
A puzzle kata, and a possible solution. When I was a boy I had a nine-piece puzzle that I'd been gifted by the Swizz branch of my family. It's called Das verflixte Hunde-Spiel, which means something like the confounded dog game in English. And while a puzzle with nine pieces does … | Continue reading
Another functional model of a file system, with code examples in C#. This article is part of a series about Zippers. In this one, I port the FSZipper data structure from the Learn You a Haskell for Great Good! article Zippers. A word of warning: I'm assuming that you're familiar … | Continue reading
A tuple or class of functors is also a functor. An article for object-oriented developers. This article is part of a series of articles about functor relationships. In this one you'll learn about a universal composition of functors. In short, if you have a product type of functor … | Continue reading
A port of another Haskell example, still just because. This article is part of a series about Zippers. In this one, I port the Zipper data structure from the Learn You a Haskell for Great Good! article also called Zippers. A word of warning: I'm assuming that you're familiar with … | Continue reading
Don't inject third-party dependencies. Use Decorators. I recently came across a Stack Overflow question that reminded me of a topic I've been meaning to write about for a long time: Cross-cutting concerns. When it comes to the usual suspects, logging, fault tolerance, caching, th … | Continue reading
A port of a Haskell example, just because. This article is part of a series about Zippers. In this one, I port the ListZipper data structure from the Learn You a Haskell for Great Good! article also called Zippers. A word of warning: I'm assuming that you're familiar with the con … | Continue reading
Some functional programming examples ported to C#, just because. Many algorithms rely on data structures that enable the implementation to move in more than one way. A simple example is a doubly-linked list, where an algorithm can move both forward and backward from a given eleme … | Continue reading
A data architecture example in C# and ASP.NET. This is part of a small article series on data architectures. In this, the third instalment, you'll see an alternative way of modelling data in a server-based application. One that doesn't rely on statically typed classes to model da … | Continue reading
A data architecture example in C# and ASP.NET. This is part of a small article series on data architectures. In this, the second instalment, you'll see a common attempt at addressing the mapping issue that I mentioned in the previous article. As the introductory article explains, … | Continue reading
A data architecture example in C# and ASP.NET. This is part of a small article series on data architectures. In the first instalment, you'll see the outline of a Ports and Adapters implementation. As the introductory article explains, the example code shows how to create a new re … | Continue reading
A comparison, for educational purposes. Use the right tool for the job. How often have you encountered that phrase when discussing software architecture? There's nothing wrong with the sentiment per se, but it's almost devoid of meaning. It doesn't pass the 'not test'. Try to neg … | Continue reading
Software development in a globalized, hostile world. Imagine that you're perusing the thriller section in an airport book store and come across a book with the following back cover blurb: Programmers are dying. Holly-Ann Kerr works as a data scientist for an NGO that fights workp … | Continue reading
Async and await are notorious for being contagious. Must all interfaces be Task-based, just in case? I recently came across this question on Mastodon: "To async or not to async? "How would you define a library interface for a service that probably will be implemented with an in m … | Continue reading
With examples in C# and F#. This article is part of a series about encapsulation and immutability. After two attempts at an object-oriented, mutable implementation, I now turn toward immutability. As already suggested in the introductory article, immutability makes it easier to m … | Continue reading
An encapsulated, albeit overly complicated, implementation. This is the second in a series of articles about encapsulation and immutability. In the next article, you'll see how immutability makes encapsulation easier, but in order to appreciate that, you should see the alternativ … | Continue reading
An instructive dead end. This article is part of a short series on encapsulation and immutability. As the introductory article claims, object mutation makes it difficult to maintain invariants. In order to demonstrate the problem, I deliberately set out to do it wrong, and report … | Continue reading
A worked example. I've noticed that many software organizations struggle with encapsulation with 'bigger' problems. It may be understandable and easily applicable to define a NaturalNumber type or ensure that a minimum value is less than a maximum value, and so on. How do you, ho … | Continue reading
Beating another dead horse. Although I live in Copenhagen and mostly walk or ride my bicycle in order to get around town, I do own an old car for getting around the rest of the country. In Denmark, cars go through mandatory official inspection every other year, and I've been thro … | Continue reading
An illustrative example. More than a decade ago, I worked on a small project. It was a small single-page application (SPA) with a REST API backend, deployed to Azure. As far as I recall, the REST API used blob storage, so all in all it wasn't a complex system. We were two develop … | Continue reading
How to stay current with technology progress. A long time ago, I landed my dream job. My new employer was a consulting company, and my role was to be the resident Azure expert. Cloud computing was still in its infancy, and there was a good chance that I might be able to establish … | Continue reading
Some thoughts on developer experience. Years ago, I was introduced to a concept called developer ergonomics. Despite the name, it's not about good chairs, standing desks, or multiple monitors. Rather, the concept was related to how easy it'd be for a developer to achieve a certai … | Continue reading
An API design heuristic. For a while now, I've been wondering whether, in the language of Postel's law, one should favour being liberal in what one accepts over being conservative in what one sends. Yes, according to the design principle, a protocol or API should do both, but som … | Continue reading
A reading of the fourth Don Box tenet, with some commentary. This article is part of a series titled The four tenets of SOA revisited. In each of these articles, I'll pull one of Don Box's four tenets of service-oriented architecture (SOA) out of the original MSDN Magazine articl … | Continue reading
The story of a fiasco. This is the second in a small series of articles titled Trying to fit the hype cycle. In the introduction, I've described the exercise I had in mind: Determining a formula, or at least a piecewise function, for the Gartner hype cycle. This, to be clear, is … | Continue reading
A reading of the third Don Box tenet, with some commentary. This article is part of a series titled The four tenets of SOA revisited. In each of these articles, I'll pull one of Don Box's four tenets of service-oriented architecture (SOA) out of the original MSDN Magazine article … | Continue reading
Another example of using Haskell as an ad-hoc scripting language. This article is part of a short series titled Trying to fit the hype cycle. In the first article, I outlined what it is that I'm trying to do. In this article, I'll describe how I extract a set of x and y coordinat … | Continue reading
An amateur tries his hand at linear modelling. About a year ago, I was contemplating a conference talk I was going to give. Although I later abandoned the idea for other reasons, for a few days I was thinking about using the Gartner hype cycle for an animation. What I had in mind … | Continue reading
A reading of the second Don Box tenet, with some commentary. This article is part of a series titled The four tenets of SOA revisited. In each of these articles, I'll pull one of Don Box's four tenets of service-oriented architecture (SOA) out of the original MSDN Magazine articl … | Continue reading
My inept adventures with a dynamically typed language. This article is the third in a small series about ad-hoc programming in two languages. In the previous article you saw how I originally solved a small data extraction and analysis problem with Haskell, even though it was stro … | Continue reading
A reading of the first Don Box tenet, with some commentary. This article is part of a series titled The four tenets of SOA revisited. In each of these articles, I'll pull one of Don Box's four tenets of service-oriented architecture (SOA) out of the original MSDN Magazin … | Continue reading
Twenty years after. In the January 2004 issue of MSDN Magazine you can find an article by Don Box titled A Guide to Developing and Running Connected Systems with Indigo. Buried within the (now dated) discussion of the technology code-named Indigo (later Windows Communica … | Continue reading
Some thoughts on testing past the happy path. Test-driven development is a great development technique that enables you to get rapid feedback on design and implementation ideas. It enables you to rapidly move towards a working solution. The emphasis on the happy … | Continue reading
Statically typed languages are also good for ad-hoc scripting. This article is part of a short series of articles that compares ad-hoc scripting in Haskell with solving the same problem in Python. The introductory article describes the problem to be solved, so here I'll … | Continue reading
With examples in C#, F#, and Haskell. This article is an instalment in a short series of articles on the Range kata. In the previous three articles you've seen the Range kata implemented in Haskell, in F#, and in C#. The reason I engaged with this kata was that … | Continue reading
Extracting and analysing data in Haskell and Python. I was recently following a course in mathematical analysis and probability for computer scientists. One assignment asked to analyze a small CSV file with data collected in a student survey. The course contained a mix o … | Continue reading
How I currently think about errors in programming. A reader recently asked a question that caused me to reflect on the way I think about errors in software. While my approach to error handling has remained largely the same for years, I don't think I've described it in an … | Continue reading
A port of the corresponding F# code. This article is an instalment in a short series of articles on the Range kata. In the previous article I made a pass at the kata in F#, using property-based testing with Hedgehog to generate test data. In the conclusion I mus … | Continue reading
This time with some property-based testing. This article is an instalment in a short series of articles on the Range kata. In the previous article I described my first attempt at the kata, and also complained that I had to think of test cases myself. When I find it tedio … | Continue reading
A first crack at the exercise. This article is an instalment in a short series of articles on the Range kata. Here I describe my first attempt at the exercise. As I usually advise people on doing katas, the first time you try your hand at a kata, use the language with wh … | Continue reading
In the languages I usually employ. The Range kata is succinct, bordering on the spartan in both description and requirements. To be honest, it's hardly the most inspiring kata available, and yet it may help showcase a few interesting points about software design in gener … | Continue reading