Services are autonomous

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


@blog.ploeh.dk | 2 days ago

Extracting data from a small CSV file with Python

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


@blog.ploeh.dk | 9 days ago

Boundaries are explicit

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


@blog.ploeh.dk | 17 days ago

The four tenets of SOA revisited

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


@blog.ploeh.dk | 24 days ago

Testing exceptions

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


@blog.ploeh.dk | 1 month ago

Extracting data from a small CSV file with Haskell

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


@blog.ploeh.dk | 1 month ago

Range as a functor

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


@blog.ploeh.dk | 1 month ago

Statically and dynamically typed scripts

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


@blog.ploeh.dk | 1 month ago

Error categories and category errors

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


@blog.ploeh.dk | 1 month ago

A Range kata implementation in C#

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


@blog.ploeh.dk | 2 months ago

A Range kata implementation in F#

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


@blog.ploeh.dk | 2 months ago

A Range kata implementation in Haskell

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


@blog.ploeh.dk | 2 months ago

Variations of the Range kata

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


@blog.ploeh.dk | 2 months ago

Serializing restaurant tables in C#

Using System.Text.Json, with and without Reflection. This article is part of a short series of articles about serialization with and without Reflection. In this instalment I'll explore some options for serializing JSON with C# using the API built into .NET: System.Text.J … | Continue reading


@blog.ploeh.dk | 3 months ago

Serializing restaurant tables in F#

Using System.Text.Json, with and without Reflection. This article is part of a short series of articles about serialization with and without Reflection. In this instalment I'll explore some options for serializing JSON with F# using the API built into .NET: System.Text.J … | Continue reading


@blog.ploeh.dk | 3 months ago

Serializing restaurant tables in Haskell

Using Aeason, with and without generics. This article is part of a short series of articles about serialization with and without Reflection. In this instalment I'll explore some options for serializing JSON using Aeson. The source code is available on GitHub. … | Continue reading


@blog.ploeh.dk | 3 months ago

Serialization with and without Reflection

An investigation of alternatives. I recently wrote a tweet that caused more responses than usual: "A decade ago, I used .NET Reflection so often that I know most the the API by heart. "Since then, I've learned better ways to solve my problem … | Continue reading


@blog.ploeh.dk | 3 months ago

Synchronizing concurrent teams

Or, rather: Try not to. A few months ago I visited a customer and as the day was winding down we got to talk more informally. One of the architects mentioned, in an almost off-hand manner, "we've embarked on a SAFe journey..." "Yes..?" I responded, hoping that m … | Continue reading


@blog.ploeh.dk | 4 months ago

Trimming a Fake Object

A refactoring example. When I introduce the Fake Object testing pattern to people, a common concern is the maintenance burden of it. The point of the pattern is that you write some 'working' code only for test purposes. At a glance, it seems as though it'd be more work t … | Continue reading


@blog.ploeh.dk | 4 months ago

CC golf

Noun. Game in which the goal is to minimise cyclomatic complexity. Cyclomatic complexity (CC) is a rare code metric since it can be actually useful. In general, it's a good idea to minimise it as much as possible. In short, CC measures looping and branching in c … | Continue reading


@blog.ploeh.dk | 4 months ago

Fakes are Test Doubles with contracts

Contracts of Fake Objects can be described by properties. The first time I tried my hand with the CQRS Booking kata, I abandoned it after 45 minutes because I found that I had little to learn from it. After all, I've already done umpteen variations of (restaurant) bookin … | Continue reading


@blog.ploeh.dk | 4 months ago

A C# port of validation with partial round trip

A raw port of the previous F# demo code. This article is part of a short article series on applicative validation with a twist. The twist is that validation, when it fails, should return not only a list of error messages; it should also retain that part of the input that … | Continue reading


@blog.ploeh.dk | 4 months ago

Domain Model first

Persistence concerns second. A few weeks ago, I published an article with the title Do ORMs reduce the need for mapping? Not surprisingly, this elicited more than one reaction. In this article, I'll respond to a particular kind of reaction. First, however, I'd l … | Continue reading


@blog.ploeh.dk | 5 months ago

At the boundaries, static types are illusory

Static types are useful, but have limitations. Regular readers of this blog may have noticed that I like static type systems. Not the kind of static types offered by C, which strikes me as mostly being able to distinguish between way too many types of integers and pointe … | Continue reading


@blog.ploeh.dk | 5 months ago

What's a sandwich?

Ultimately, it's more about programming than food. The Sandwich was named after John Montagu, 4th Earl of Sandwich because of his fondness for this kind of food. As popular story has it, he found it practical because it enabled him to eat without greasing the cards he of … | Continue reading


@blog.ploeh.dk | 5 months ago

Dependency Whac-A-Mole

AKA Framework Whac-A-Mole, Library Whac-A-Mole. I have now three times used the name Whac-A-Mole about a particular kind of relationship that may evolve with some dependencies. According to the rule of three, I can now extract the explanation to a separate article. This … | Continue reading


@blog.ploeh.dk | 5 months ago

The case of the mysterious comparison

A ploeh mystery. I was recently playing around with the example code from my book Code That Fits in Your Head, refactoring the Table class to use a predicative NaturalNumber wrapper to represent a table's seating capacity. Originally, the Table constructor and c … | Continue reading


@blog.ploeh.dk | 6 months ago

Do ORMs reduce the need for mapping?

With some Entity Framework examples in C#. In a recent comment, a reader asked me to expand on my position on object-relational mappers (ORMs), which is that I'm not a fan: I consider ORMs a waste of time: they create more problems than they solve. … | Continue reading


@blog.ploeh.dk | 6 months ago

Decomposing CTFiYH's sample code base

An experience report. In my book Code That Fits in Your Head (CTFiYH) I write in the last chapter: If you've looked at the book's sample code base, you may have noticed that it looks disconcertingly monolithic. If you consider the full code base that inclu … | Continue reading


@blog.ploeh.dk | 6 months ago

A first crack at the Args kata

Test-driven development in C#. A customer hired me to swing by to demonstrate test-driven development and tactical Git. To make things interesting, we agreed that they'd give me a kata at the beginning of the session. I didn't know which problem they'd give me, so I thou … | Continue reading


@blog.ploeh.dk | 7 months ago

Compile-time type-checked truth tables

With simple and easy-to-understand examples in F# and Haskell. Eve Ragins recently published an article called Why you should use truth tables in your job. It's a good article. You should read it. In it, she outlines how creating a Truth Table can help you smoke … | Continue reading


@blog.ploeh.dk | 7 months ago

Replacing Mock and Stub with a Fake

A simple C# example. A reader recently wrote me about my 2013 article Mocks for Commands, Stubs for Queries, commenting that the 'final' code looks suspect. Since it looks like the following, that's hardly an overstatement. public User GetUser(int userId) {      … | Continue reading


@blog.ploeh.dk | 7 months ago

NonEmpty catamorphism

The universal API for generic non-empty collections, with examples in C# and Haskell. This article is part of an article series about catamorphisms. A catamorphism is a universal abstraction that describes how to digest a data structure into a potentially more compact va … | Continue reading


@blog.ploeh.dk | 7 months ago

Test-driving the pyramid's top

Some thoughts on TDD related to integration and systems testing. My recent article Works on most machines elicited some responses. Upon reflection, it seems that most of the responses relate to the top of the Test Pyramid. While I don't have an one-shot solution … | Continue reading


@blog.ploeh.dk | 8 months ago

Is software getting worse?

A rant, with some examples. I've been a software user for thirty years. My first PC was DOS-based. In my first job, I used OS/2, in the next, Windows 3.11, NT, and later incarnations of Windows. I wrote my first web sites in Arachnophilia, and my first … | Continue reading


@blog.ploeh.dk | 8 months ago

Works on most machines

TDD encourages deployment flexibility. Functional programming also helps. Recently several of the podcasts I subscribe to have had episodes about various container technologies, of which Kubernetes dominates. I tune out of such content, since it has nothing to do with me … | Continue reading


@blog.ploeh.dk | 8 months ago

AI for doc comments

A solution in search of a problem? I was recently listening to a podcast episode where the guest (among other things) enthused about how advances in large language models mean that you can now get these systems to write XML doc comments. You know, these things: … | Continue reading


@blog.ploeh.dk | 8 months ago

Validating or verifying emails

On separating preconditions from business rules. My recent article Validation and business rules elicited this question: "Regarding validation should be pure function, lets have user registration as an example, is checking the email address uniqueness a va … | Continue reading


@blog.ploeh.dk | 8 months ago

Validation and business rules

A definition of validation as distinguished from business rules. This article suggests a definition of validation in software development. A definition, not the definition. It presents how I currently distinguish between validation and business rules. I find the distinct … | Continue reading


@blog.ploeh.dk | 9 months ago

When is an implementation detail an implementation detail?

On the tension between encapsulation and testability. This article is part of a series called Epistemology of interaction testing. A previous article in the series elicited this question: "following your suggestion, aren’t we testing implementation details … | Continue reading


@blog.ploeh.dk | 9 months ago

Collatz sequences by function composition

Mostly in C#, with a few lines of Haskell code. A recent article elicited more comments than usual, and I've been so unusually buried in work that only now do I have a little time to respond to some of them. In one comment Struan Judd offers a refactored version of my Co … | Continue reading


@blog.ploeh.dk | 9 months ago

The Git repository that vanished

A pair of simple operations resurrected it. The other day I had an 'interesting' experience. I was about to create a small pull request, so I checked out a new branch in Git and switched to my editor in order to start coding when the battery on my laptop died. C … | Continue reading


@blog.ploeh.dk | 9 months ago

Favour flat code file folders

How code files are organised is hardly related to sustainability of code bases. My recent article Folders versus namespaces prompted some reactions. A few kind people shared how they organise code bases, both on Twitter and in the comments. Most reactions, however, carry … | Continue reading


@blog.ploeh.dk | 10 months ago

Visual Studio Code snippet to make URLs relative

Yes, it involves JSON and regular expressions. Ever since I migrated the blog off dasBlog I've been writing the articles in raw HTML. The reason is mostly a historical artefact: Originally, I used Windows Live Writer, but Jekyll had no support for that, and since I'd bee … | Continue reading


@blog.ploeh.dk | 10 months ago

Folders versus namespaces

What if you allow folder and namespace structure to diverge? I'm currently writing C# code with some first-year computer-science students. Since most things are new to them, they sometimes do things in a way that are 'not the way we usually do things'. As an example, tea … | Continue reading


@blog.ploeh.dk | 10 months ago

Is cyclomatic complexity really related to branch coverage?

A genuine case of doubt and bewilderment. Regular readers of this blog may be used to its confident and opinionated tone. I write that way, not because I'm always convinced that I'm right, but because prose with too many caveats and qualifications tends to bury the messa … | Continue reading


@blog.ploeh.dk | 10 months ago

Refactoring pure function composition without breaking existing tests

An example modifying a Haskell Gossiping Bus Drivers implementation. This is an article in an series of articles about the epistemology of interaction testing. In short, this collection of articles discusses how to test the composition of pure functions. While a pure fun … | Continue reading


@blog.ploeh.dk | 11 months ago

Are pull requests bad because they originate from open-source development?

I don't think so, and at least find the argument flawed. Increasingly I come across a quote that goes like this: Pull requests were invented for open source projects where you want to gatekeep changes from people you don't know and don't trust to change th … | Continue reading


@blog.ploeh.dk | 11 months ago