Uncategorized

  • Test doubles for an interface you do not own

    Mocking a third-party class binds the test to that class’s current signature, so an upgrade changing a method leaves the test passing against a shape that no longer…

  • Multi-stage builds cut the image in half

    17.05 made the two-Dockerfile trick unnecessary. Named stages, what to copy forward, and why the build cache still rewards the order of instructions.

  • iterable accepts an array or a Traversable

    Type-hinting array rejects a generator, and hinting Traversable rejects an array — so a function meant to consume a sequence either had no hint or forced the caller…

  • Ansible is idempotent only if you write it that way

    The modules are idempotent and shell and command are not, so a playbook that reaches for them loses the property the tool exists for — and reports “changed”…

  • CRUD objects load lazily, which changes your query count

    A 2.6 product was hydrated from the post and its meta in one pass. A 3.0 product reads what it is asked for, which is usually fewer queries…

  • Package auto-discovery, and how to opt a package out

    5.5 reads a package’s extra.laravel block and registers its providers and aliases automatically, which removes two config edits from every installation and removes them from view as well.…

  • Closure::fromCallable turns a string into a closure

    PHP has several callable syntaxes — a string, an array of object and method, an invokable — and functions accepting callable have to tolerate all of them. Converting…

  • Read models can be stale and must say so

    A projection updated asynchronously is behind by some amount, usually milliseconds and occasionally minutes. Hiding that from the caller makes every consumer assume it is current, and one…

  • Domain events belong to the aggregate that raised them

    Publishing an event from a service layer means the aggregate can change state without the event being raised, because the two are in different places and only convention…

  • Bulkheads keep one slow dependency from taking the pool

    The name comes from ship compartments: a breach floods one section rather than the hull. Applied to a request path, it means each dependency gets a share of…