OGOnkesh Guptainonkeshgupta.hashnode.dev·4d ago · 6 min readDesign Patterns Simplified #2: Factory MethodThe Problem You are building the payment flow for an app. First requirement: support Stripe. Simple. Somewhere in your checkout code, you write: StripeGateway* gateway = new StripeGateway(); gateway->00
OGOnkesh Guptainonkeshgupta.hashnode.dev·Sep 3 · 7 min readDesign Patterns Simplified: Creational, Structural & Behavioral - The Map Before The TerritoryYou just finished SOLID. Five principles, five "aha" moments, five checkmarks. Nice. Then you open a design patterns cheat sheet for the first time and see 23 of them. Singleton. Factory. Adapter. Dec00
OGOnkesh Guptainonkeshgupta.hashnode.dev·Sep 1 · 8 min readSOLID Principles Simplified #5: Dependency Inversion PrincipleThe Problem You're building a NotificationService for your app. First requirement is to send notifications over email. Simple enough. You write an EmailSender class and inside NotificationService, you02N
OGOnkesh Guptainonkeshgupta.hashnode.dev·Aug 25 · 8 min readSOLID Principles Simplified #4: Interface Segregation PrincipleThe Problem You're building a Printer interface for an office automation system. First requirement: Print the documents. Sounds easy. So you add print() method. Two weeks later: "Hey, can it also scan00
OGOnkesh Guptainonkeshgupta.hashnode.dev·Aug 22 · 6 min readSOLID Principles Simplified #3: Liskov Substitution Principle (LSP)Okay... That sounds much more complicated than it needs to be. What does "usable wherever" actually mean? Let's forget the definition for a moment and start with a problem. Imagine this... You are bui00