software-design/

Architecture, patterns, testing, refactoring and code review.

6 results
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… 5 min read · 30 Oct 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… 5 min read · 27 Oct 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… 5 min read · 12 Oct 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… 5 min read · 9 Oct 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… 11 min read · 1 Oct software-design/functions-why-you-should-stop-copy-pasting-your-code.md Functions: Why You Should Stop Copy-Pasting Your Code Copy-pasting code works fine on the day you do it. It fails the day you need to change it, and have to find and fix every copy without… 9 min read · 1 Oct