Category Design Pattern

Dependency Inversion Principle

Our Renewal Reminders Went to Expired Customers, and We Couldn’t Test It The task sounded simple: email customers 3 days before their subscription expires. A few weeks after launch, support forwarded us angry messages. Customers whose subscriptions had already expired…

Interface Segregation Principle

We Needed a Read-Only Repository. The Interface Forced Us to Fake Seven Methods. Our reporting queries were slowing down the main database. The fix was clear: send report queries to a read replica. So I created ReadReplicaUserRepository. Then I opened…

Liskov Substitution Principle

Support Clicked “Refund.” The Server Threw an Exception. We added gift cards as a payment method. Quick job: create a GiftCardPayment class, inherit from our PaymentMethod base class, done. Two weeks later, a support agent clicked Refund on an order…

Open/Closed Principle

Adding One Shipping Option Broke International Orders for an Hour Marketing wanted a “same-day delivery” option for Black Friday weekend. Easy request. I opened our ShippingCalculator, added one more else-if, and deployed. An hour later, support told us international customers…