SOLID in one page 00:00:00 Make a prediction You will use the five SOLID principles to explain one real change to checkout and identify which change actually earns an abstraction. A shop adds printed receipts. Must we edit the class that computes tax just because our existing checkout emails every receipt? No. Tax and delivery answer to different changes. Give receipt delivery its own contract, and make sure email and print implementations preserve the same stated outcome. 00:00:32 Asha's marble run A marble run has a ramp, funnel and bell. Add a wheel by connecting it to the standard mounting holes. A false ramp can fit those holes yet block the marble. A funnel only needs the peg it actually uses. Responsibility determines each piece's job, open extension accepts the wheel, substitution requires the marble to pass, segregation avoids unused pegs, and dependency inversion lets the board define the connector. SOLID is a set of five design principles. Each answers one question about change. S: who may ask for a change here? O: can a new kind arrive without an edit? L: can I trust every kind to keep the promise? I: does each caller see only what it needs? D: does the important code depend on details? In a low-level design round the interviewer changes the requirements in the last ten minutes. A design of long if chains and god classes falls apart at that moment. A design along these five questions answers with a new class and one line of wiring. 00:01:42 Add a second receipt channel Checkout charges an order and also knows every email delivery detail. A new receipt channel now changes a class that already changes for pricing rules. Move delivery behind a receipt sender chosen when checkout is assembled. The sender promises whether delivery was accepted and every implementation must honour that promise. Add a print sender and test checkout with a recording sender. This single change illustrates responsibility, substitution and dependency direction together. Use an in-memory sender to record the receipt value, then a sender that returns unavailable. The checkout test should observe its response to the failure without owning printer setup. If every tiny receipt field grows a separate interface, count how many files a single real change now touches. 00:02:32 Give separate clients separate contracts A cashier prints receipts, while an auditor reads archived receipts. Giving both clients a giant printer-and-archive interface forces test doubles to implement operations they never use. Split those contracts. A component that genuinely needs both can receive both. Give a print-only kiosk a test double. It should only need to understand the printing promise. Now add an archive indexer that reads saved receipts. Demanding that each double implement both jobs couples those two callers, even if the production class happens to provide both. Five class names do not prove five sound decisions. If a print sender promises accepted while dropping receipts, substitution still fails. Start with the first real source of change. A small tested function can satisfy a present requirement without creating a hierarchy for future channels. Active Merchant. A payment library extracted from Shopify, built around one unified API for dozens of payment gateways with very different APIs inside. Order code does not change for another gateway (O, D). Stripe, Adyen or PayPal each become an adapter. Django storage backends. A custom storage is a subclass of Storage that keeps its methods. Files can live on disk or with a cloud provider while application code stays (L, D). 00:04:01 Try an interview follow-up When would you tell a team to stop applying SOLID? I would reconsider a principle when ordinary changes start touching more files and tests require more artificial stand-ins. I would compare two recent changes before and after the split. If the new structure helps neither case, I would simplify it and preserve the behaviour with the same tests. A cafe changes its tax calculation and buys a new printer in the same week. Trace both changes through one Receipt class. Extract the printer boundary first if hardware failures are the immediate testing problem. Point to the test that becomes simpler. Use principles to justify a specific decision in this design. 00:04:45 What to take with you S: one group of people per class. O: new kinds arrive as new code. L: every kind keeps the promise. I: callers see only what they use. D: important code owns the contract, details follow it. Apply them from the change backwards: take the wish that comes next, see how many files it touches, and use the one letter that shortens the list.