Skip to content
Tutorials Center
My learning

Topics

Design Patterns and OOP Design (LLD) Tutorial

Learn Design Patterns and OOP Design (LLD) step by step: 57 lessons in 9 chapters with examples, quizzes, diagrams and projects.

Start learning →

of lessons completed

Getting Started with Design

  1. 1 What Are Design Patterns? Learn what design patterns are, where they come from, how they differ from algorithms and frameworks, when they hurt, and how to read a pattern description.
  2. 2 Reading and Drawing UML for Low-Level Design Read and draw UML class diagrams and sequence diagrams for low-level design: relationships, multiplicity, visibility and Mermaid syntax, with runnable examples.
  3. 3 OOP Foundations for Design Review encapsulation, abstraction, inheritance and polymorphism with a design focus. Compare interfaces and abstract classes across Java, C++, Python and JavaScript.

Design Principles

  1. 4 SOLID at a Glance A tour of the five SOLID principles: why they exist, how they relate to design patterns, their trade-offs, and a runnable example of code that breaks several at once.
  2. 5 Single Responsibility Principle Learn the Single Responsibility Principle: reasons to change, cohesion, how to split a god class, and a before and after report printer example you can run.
  3. 6 Open/Closed Principle Learn the Open/Closed Principle: extend behavior without editing tested code. Replace if-else chains with polymorphism and strategy in a runnable discount example.
  4. 7 Liskov Substitution Principle Learn the Liskov Substitution Principle: behavioral subtyping, the square and rectangle trap, contracts, and a contract test that catches violations.
  5. 8 Interface Segregation Principle Learn the Interface Segregation Principle: why fat interfaces hurt, how role interfaces fix them, with a printer and scanner example and mixins.
  6. 9 Dependency Inversion and Dependency Injection Understand the Dependency Inversion Principle, constructor injection and inversion of control, and build a tiny dependency injection container.
  7. 10 Inversion of Control and IoC Containers Learn what Inversion of Control means, how it differs from Dependency Injection, the Service Locator and DIP, and build a small IoC container with lifetimes and cycle detection.
  8. 11 DRY, KISS, YAGNI, Law of Demeter and Composition over Inheritance Learn the everyday design rules beyond SOLID: DRY, KISS, YAGNI, the Law of Demeter, tell don't ask, cohesion, coupling and composition over inheritance.

Creational Patterns

  1. 12 Singleton Learn the Singleton design pattern: lazy and eager creation, thread safety in Java and C++, module singletons, and why it often hurts testing.
  2. 13 Factory Method Learn the Factory Method design pattern: creator and product hierarchies, parameterized factories, static factory methods and when to use each.
  3. 14 Abstract Factory Learn the Abstract Factory design pattern: build families of related objects, such as a UI theme kit, and swap the whole family at runtime.
  4. 15 Builder Learn the Builder design pattern: avoid telescoping constructors, write fluent builders, use a director, and validate in build() to get immutable objects.
  5. 16 Prototype Learn the Prototype design pattern: create objects by cloning, understand shallow vs deep copies, use a prototype registry and structuredClone.
  6. 17 Object Pool, Lazy Initialization and Dependency-Free Creation Learn the Object Pool and Lazy Initialization patterns: reuse expensive objects, write a connection pool, build a lazy proxy and know when not to pool.

Structural Patterns

  1. 18 Adapter Learn the Adapter design pattern: wrap an incompatible interface so it fits yours, with legacy API and payment gateway examples and the object vs class forms.
  2. 19 Bridge Learn the Bridge design pattern: split an abstraction from its implementation so shapes and renderers vary independently and classes do not multiply.
  3. 20 Composite Learn the Composite design pattern: treat single objects and groups the same way through one interface, with a file system tree and recursion examples.
  4. 21 Decorator Learn the Decorator design pattern: wrap an object to add behavior at run time, stack decorators, and compare the pattern with Python and JavaScript decorators.
  5. 22 Facade Learn the Facade design pattern: hide a complicated subsystem behind one simple interface, with home-theater and checkout examples, and compare it with Adapter.
  6. 23 Flyweight Learn the Flyweight design pattern: split intrinsic from extrinsic state and share objects to save memory, with a text editor glyph example and size estimates.
  7. 24 Proxy Learn the Proxy design pattern: virtual, protection, caching and logging proxies, the JavaScript Proxy object, and how a remote proxy hides the network.

Behavioral Patterns

  1. 25 Strategy Learn the Strategy design pattern: make algorithms interchangeable, replace long if-else chains, and use plain functions as strategies in sorting and pricing.
  2. 26 Observer Learn the Observer design pattern: one subject notifies many observers when it changes. Covers push vs pull, EventEmitter, and memory leaks from forgotten unsubscribes.
  3. 27 Command Learn the Command design pattern: turn a request into an object so you can undo it, redo it, queue it, log it and combine commands into macros.
  4. 28 State Learn the State design pattern: let an object change its behavior when its state changes. Compare state objects with enums using a vending machine and order workflow.
  5. 29 Template Method Learn the Template Method design pattern: define the skeleton of an algorithm in a base class, let subclasses fill in steps and hooks, and compare it with Strategy.
  6. 30 Iterator Learn the Iterator design pattern: visit the items of a collection one at a time without exposing its structure. Includes JS generators, Python __iter__ and Java Iterable.
  7. 31 Chain of Responsibility Learn the Chain of Responsibility design pattern: pass a request along a chain of handlers. Covers approval workflows, middleware pipelines and logging levels.
  8. 32 Mediator and Memento Learn the Mediator pattern to centralize communication between objects and the Memento pattern to save and restore state for undo, with runnable examples.
  9. 33 Visitor, Interpreter and Null Object Learn Visitor and double dispatch to add operations to a class hierarchy, Interpreter for small languages, and Null Object to remove null checks.
  10. 34 Interpreter Pattern in Depth Learn the Interpreter design pattern step by step: define a grammar, build terminal and non-terminal expression classes, parse text into a tree and evaluate it.
  11. 35 Null Object Pattern Learn the Null Object pattern: replace null with a do-nothing object that shares the interface, remove scattered null checks, and know when this hides real errors.

Architectural and Modern Patterns

  1. 36 Repository and Unit of Work Separate persistence from domain logic with the Repository pattern, test with in-memory repositories, and group changes into one transaction with Unit of Work.
  2. 37 MVC, MVP and MVVM Compare MVC, MVP and MVVM presentation patterns: what each part does, how data flows, and where each fits, with a runnable tiny MVC app and a view-model.
  3. 38 Dependency Injection, Service Locator and Plugin Architectures Wire objects with a composition root, see why the Service Locator hides dependencies, build a plugin registry, and test with fakes and spies.
  4. 39 Patterns Across Languages: Java, C++, Python and JavaScript See how design patterns change across Java, C++, Python and JavaScript: which ones vanish with closures, duck typing and modules, and what RAII replaces.
  5. 40 CQRS: Command Query Responsibility Segregation Learn CQRS: split the write model from the read model, keep them in sync with events, and know the costs. Includes a runnable order example with a projection.
  6. 41 Event Sourcing Learn Event Sourcing: store every change as an event, rebuild state by replay, speed it up with snapshots, and know when this pattern is worth its cost.
  7. 42 Event-Driven Architecture Learn event-driven architecture: producers, consumers and brokers, pub/sub versus queues, event notification versus state transfer, and the limits to plan for.
  8. 43 Circuit Breaker, Retry and Bulkhead Patterns Learn resilience patterns for calling unreliable services: retry with backoff, circuit breaker states, fallbacks and bulkheads, with runnable stand-ins you can step through.

Anti-Patterns and Refactoring

  1. 44 Anti-Patterns and Code Smells Learn the most common design anti-patterns and code smells: god object, spaghetti code, singleton abuse, anemic model, golden hammer and primitive obsession, with fixes.
  2. 45 Refactoring to Patterns Learn how to refactor messy conditional code to Strategy, State and Factory step by step, with characterization tests that stay green after every small change.

Low-Level Design Projects

  1. 46 How to Approach a Low-Level Design Problem A repeatable framework for low-level design: clarify requirements, find entities, model relationships, define APIs, apply patterns, handle concurrency and plan extensions.
  2. 47 Project: Parking Lot Design a parking lot system step by step: vehicles, spots, tickets, a pricing strategy, a vehicle factory and concurrency, with a complete runnable Node.js model.
  3. 48 Project: Elevator System Design an elevator system with the State pattern for each car, a scheduling strategy for dispatching, a request queue and an observer for floor displays, in runnable Node.js.
  4. 49 Project: Library Management System Design a library system: members, books, copies, loans, reservations, fine strategies, an observer for notifications and a repository layer, with runnable Node.js code.
  5. 50 Project: Ride Sharing and Vending Machine Two classic low-level design projects: a ride-sharing dispatcher with matching and pricing strategies, and a vending machine built with State and Command.
  6. 51 Project: Text Editor with Undo and a Chess Engine Core Build a text editor with undo and redo using Command and Memento, then model a chess core with Strategy for piece movement and Composite for armies.
  7. 52 Project: In-Memory File System Design an in-memory file system step by step: files and directories as a Composite tree, path resolution, mkdir, read, write, ls, mv and rm, with runnable Node.js code.

Practice and Interview Prep

  1. 53 Design Pattern Exercises with Solutions Practice 15 design pattern exercises across creational, structural and behavioral patterns, each with a short runnable JavaScript solution and review hints.
  2. 54 Low-Level Design Exercises with Solutions Six classic low-level design exercises with runnable Node.js solutions: ATM, notification service, rate limiter, logger framework, LRU cache and tic-tac-toe.
  3. 55 Design Pattern and OOP Interview Questions More than 40 design pattern, OOP and SOLID interview questions with concise answers, comparisons such as strategy vs state, and two runnable code demos.
  4. 56 Design Patterns Cheat Sheet A one-page design patterns cheat sheet: intent, when to use, structure, pitfalls and language idioms for every GoF pattern plus SOLID and a pattern picker.
  5. 57 Design Patterns Hidden in the JDK and Popular Frameworks Spot Singleton, Factory, Builder, Decorator, Observer, Iterator, Strategy and more inside the Java standard library and Spring, with runnable examples.