software-design/
Architecture, patterns, testing, refactoring and code review.
13 results
software-design/feature-flags-how-to-ship-code-switched-off-and-turn-it-on-for-10-of-u.md
Feature flags: how to ship code switched off and turn it on for 10% of users
A feature flag is a yes/no setting your code checks before choosing between old and new behaviour, so you can ship code switched off and…
software-design/composition-vs-inheritance-why-a-toy-duck-shouldn-t-learn-to-fly.md
Composition vs inheritance: why a toy duck shouldn't learn to fly
A rubber duck that learns to fly is a classic sign that inheritance, the "is a" way of sharing code, has been stretched too far. Every…
software-design/the-observer-pattern-how-a-shop-tells-many-functions-about-one-order-w.md
The observer pattern: how a shop tells many functions about one order without knowing them
A shop that must email a receipt, update stock and add loyalty points ends up with one function that knows about everything. Every new…
software-design/refactoring-how-to-tidy-working-code-without-breaking-it.md
Refactoring: how to tidy working code without breaking it
Refactoring means changing how code is built on the inside without changing what it does. It sounds risky, but there is a simple routine…
software-design/unit-tests-why-four-passing-tests-don-t-prove-a-function-works.md
Unit tests: why four passing tests don't prove a function works
Your function gave the right answer four times. Is it correct? Not necessarily: passing tests only show the bug isn't where you looked…
software-design/idempotency-why-clicking-pay-twice-should-charge-you-once.md
Idempotency: why clicking Pay twice should charge you once
You tap Pay, the screen shows an error, you tap again, and your card is charged twice. Networks drop messages, so a phone often cannot tell…
software-design/state-machines-why-an-order-can-t-be-delivered-before-it-s-paid.md
State machines: why an order can't be delivered before it's paid
An online order can be in the cart, paid, shipped, delivered or cancelled, but what stops the code from delivering an order nobody paid…
software-design/dependency-injection-why-a-test-passes-at-9am-and-fails-at-3pm.md
Dependency injection: why a test passes at 9am and fails at 3pm
A test that passes in the morning and fails in the afternoon, with no change to the code, is a puzzle many beginners meet. The cause is…
software-design/pure-functions-why-the-same-call-can-give-two-different-answers.md
Pure functions: why the same call can give two different answers
Call a function twice with the same input and get two different answers? Python isn't broken. The function is doing something extra, called…
software-design/refactoring-tidy-messy-code-without-breaking-it-using-tests-as-a-net.md
Refactoring: tidy messy code without breaking it, using tests as a net
Refactoring means changing how code is written without changing what it does, so the next person (often you) can read it. It sounds risky…
software-design/your-first-unit-test-catch-the-leap-year-bug-a-quick-check-misses.md
Your first unit test: catch the leap-year bug a quick check misses
A unit test is a tiny piece of code that checks another piece of code: you pick an input, write down the answer you expect, and let the…
software-design/how-to-read-a-python-error-message-without-panicking.md
How to read a Python error message without panicking
When Python crashes it prints a traceback: a report of what went wrong and where. It looks scary, but it has a fixed shape, and the most…