You're building a file system explorer. Files are simple objects, but directories can contain both files and other directories. How do you write code that treats individual files and entire…
You're building an expense approval system. Expenses under £100 can be approved by a manager, under £1000 by a director, and above that by a VP. Hardcoding these rules creates…
You've just integrated a third-party payment library into your e-commerce application. Everything looks good until you realize the library expects PaymentRequest objects, but your codebase uses Order objects. Do you refactor your entire system,…
One Instance to Rule Them All
What happens when two parts of your application create separate database connection pools, each consuming 100 connections? Or when multiple loggers write to the…
Clone Instead of Reconstruct
What if creating a new object is so expensive that copying an existing one is faster? What if you need to create objects without knowing their…
Taming Complex Object Construction
Have you ever seen a constructor with 15 parameters where you can't remember which boolean is "enabled" and which is "visible"? Or created an object that…
