CS core subjects

Stage 2 · Lesson 8 of 8

Design patterns: a first handful

Object-oriented programming and design

A is a named, reusable solution to a design problem that keeps coming up. Start with five you will meet everywhere. Strategy lets you swap one algorithm for another.

Observer tells a list of listeners when something changes, like a button telling every handler it was clicked. Factory hides which class gets created. Adapter makes one interface fit another, like a travel plug.

Decorator adds behaviour by wrapping an object. Knowing the names gives you a shared vocabulary for . It also helps you spot these shapes in you already use.

Each pattern is and interfaces applied to one problem, so the earlier topics make them easy. Used well, they keep low, so parts depend on each other less.

Common trapforcing patterns into small programs to look sophisticated; use one only when you feel the problem it solves.

A question to check yourself, an AI practice session and 2 cheat sheet entries come with the full roadmap. Unlock

Resources for this stage

Start with· follow one of these

  • CoursePaid
    Grokking SOLID Design Principles

    Design Gurus · Beginner · $50 one-time

    Each SOLID principle with a broken example and its fix, at a beginner-friendly pace

  • CourseFree
    Java Programming MOOC

    University of Helsinki · Beginner

    Free, exercise-heavy course whose second half is a thorough, tested introduction to OOP

Keep handy

Also worth your time

Mark this stage as not done?