0 XP · 0 scenes

Object-oriented design

Low-Level Design: SOLID and 23 Design Patterns

Every pattern is taught from the pain it removes. You see the tangled design, the clean design as a class diagram, an animated flow of the calls between objects, and code in Python and Java.

28 lessons: the five SOLID principles and the classic creational, structural and behavioral patterns.

SOLID principles

Five habits that keep classes easy to change. Patterns are just these habits with names.

Creational patterns

How objects get made without the caller knowing the messy details.

Structural patterns

How classes and objects are put together into bigger, flexible shapes.

  • AdapterMake an incompatible interface fit the one you expect
  • BridgeSplit a thing into two parts that can vary on their own
  • CompositeTreat one item and a group of items the same way
  • DecoratorAdd features to an object by wrapping it
  • FacadeOne simple front door for a complicated subsystem
  • FlyweightShare the common part of many similar objects
  • ProxyA stand-in that controls access to the real object

Behavioral patterns

How objects talk, share work and change behaviour at run time.

  • Chain of ResponsibilityPass a request along handlers until one deals with it
  • CommandTurn a request into an object you can store, queue or undo
  • InterpreterRepresent a small language as classes and evaluate it
  • IteratorWalk through a collection without knowing how it is stored
  • MediatorLet objects talk through a middleman, not to each other
  • MementoSave a snapshot of an object so you can restore it later
  • ObserverTell everyone who is interested when something changes
  • StateAn object changes its behaviour when its state changes
  • StrategySwap an algorithm without changing the code that uses it
  • Template MethodFix the steps of a recipe, let subclasses fill in some of them
  • VisitorAdd new operations to a set of classes without editing them

Related guides

Common questions

What is low-level design?

Low-level design (LLD) is designing the classes, interfaces and objects inside one program: who owns which data, how objects talk to each other, and how to add a feature without rewriting old code. It is a common machine-coding and object-oriented design interview round.

Which design patterns should I learn first?

Start with the SOLID principles, then Strategy, Observer, Factory Method, Decorator and Singleton. They appear most often in interviews and real code. Each lesson shows the problem first, so you learn when to use a pattern, not only its shape.

Are the examples in Python or Java?

Both. Every pattern has code in Python and in Java, and a small demo that runs.

How are the lessons laid out?

A picture from daily life, the problem without the pattern (as a diagram and as code), the fix (as a class diagram), a step-by-step animation of the calls, and then the code.