design-patterns

  • The read model that finally earned its place

    A projection deleted in 2023 for being premature, rebuilt in 2025 because the query is now eleven seconds.

  • The anti-corruption layer that needed a second mapper

    One supplier, two API versions running simultaneously during their own migration, and a translation layer built for one shape. The layer had assumed one upstream shape at a…

  • A test double that had drifted from the real thing

    An in-memory repository passing every test, and a real one that had gained a behaviour the fake did not have. A constraint added to the database is a…

  • The PSR-18 client I wrote for one API

    A supplier API with a signing scheme, a rate limit and a pagination style of its own, and the same four concerns implemented in three places.

  • A domain event with a field that was presentation

    An OrderPlaced event carrying a formatted currency string, which is a decision about a locale baked into a permanent record. The formatted string was convenient for the one…

  • A package I published, and the API design I got wrong twice

    turkerdev/php-figma-api, a typed client for a third-party REST API, and two design mistakes that only appear once somebody else uses it.

  • Two serialisers, one controller

    Versioning the representation rather than the code, so the business logic exists once. Duplicating the controller is the obvious move and it duplicates the authorisation, the loading and…

  • A first-class callable stored on a readonly property

    A strategy passed to a constructor as a callable, which used to be a closure with a comment and is now something an analyser can check. The docblock…

  • Laravel 12, and a starter kit we did not use

    A major release in February that is deliberately almost nothing, and an upgrade guide that fits on a page.

  • A specification object whose two paths disagreed

    A specification with an in-memory check and a query builder, both correct in isolation and disagreeing on a boundary. One character apart, and the report listed orders the…