OOP & low-level design

SOLID, composition over inheritance, a handful of patterns (strategy, observer, factory). Design-a-parking-lot / design-Splitwise rounds live here.

About 34 min read3-question knowledge check

The mental model

Low-level design is deciding where the seams go before you cut. A garment maker does not sew a shirt as one continuous piece of fabric — they cut panels (front, back, sleeves, collar) and join them at seams, because a torn sleeve should be replaceable without rebuilding the shirt. Object-oriented design is the same discipline for code: you decide which responsibilities live together in one object and where the seams between objects fall, so that a change to one part does not force a rebuild of the whole.

The unit of OOP is the object, which bundles data with the behaviour that operates on it. That bundling is not the point — the point is the seam it creates: everything outside the object talks to it through a small, stable interface and knows nothing of its insides. When you get the seams right, a new payment method, a new discount rule, or a new notification channel is a new small panel stitched in at an existing seam. When you get them wrong, every change ripples across objects that should not have known about each other, and you are re-sewing the whole shirt for a button.

SOLID is five rules for where to put seams, and the one that matters most is the first: a class should have a single responsibility — one reason to change. A class that formats a report and emails it and decides who receives it has three reasons to change, so a change to the email provider risks breaking the formatting. Split those seams and each panel changes independently.

**Why this exists in interviews.** Machine-coding and LLD rounds — design a parking lot, a Splitwise, an elevator, a vending machine — are the fastest way to see whether a candidate models a problem into objects with clean seams or produces one giant class with a switch statement for every case. Indian product companies weight this heavily: you build a runnable, cleanly-modelled app in 90 minutes and then defend it while the interviewer extends the spec live ("now add groups", "now settle-up must minimise transactions"). The design that absorbs the extension without a rewrite passes; the one that shatters fails. The signal is not knowing patterns by name — it is putting the seams where change will actually happen.

The full lesson continues with 15 more sections
  • Deep dive
  • Internal architecture
  • Real-world use cases
  • Best practices
  • Common mistakes
  • Performance
  • Security
  • Production troubleshooting
  • Advantages & disadvantages
  • Alternatives
  • Interview expectations
  • Interview questions
  • Facts to remember
  • Cheat sheet
  • Quick revision