DSA Factory
All free lessons
OOP and design

Free Design patterns lessons

9 lessons, about 2 hours in all. Each teaches one idea with a visual, then gives you a problem or a few questions on it. Read the lessons here, then create a free account to practise and keep your progress.

Stage 0Creating objects

  1. SingletonOne instance for the whole program: how to write it correctly, why it is controversial, and what to use instead.12 min
  2. FactoryMoving the choice of which class to create out of the caller: the simple factory, the factory method and the abstract factory.12 min
  3. BuilderConstructing an object with many optional parts step by step, instead of a constructor with a dozen parameters.11 min

Stage 1Structuring objects

  1. Adapter and facadeTwo wrappers with different jobs: making an incompatible interface fit, and hiding a complicated subsystem behind a simple one.12 min
  2. DecoratorAdding behaviour to an object by wrapping it in another with the same interface, instead of subclassing for every combination.12 min

Stage 2Behaviour and communication

  1. StrategySwapping an algorithm by putting each variant behind an interface and handing one to the object that needs it.12 min
  2. ObserverLetting many objects react to a change in another, without that object knowing who is listening.12 min
  3. StateLetting an object change how it behaves as its state changes, by moving each state's behaviour into its own class.12 min
  4. Choosing a patternStart from the force, not the name: a quick map from the problem you have to the pattern that answers it, and when none is needed.12 min

All of Design patterns is free

That’s the whole topic, from the first idea to the mastery stage, with no card needed. Create a free account to practise, keep your progress and carry on to the next topic.

Create your free account