What Design Patterns Are

What design patterns are: named, reusable solutions to recurring object-oriented design problems, how the 23 classic ones are grouped, and when one costs more than it saves.

  • 8 cards
  • 5 questions
  • About 16 min
  • Beginner to Intermediate
Share

A design pattern is a named solution to a design problem that keeps coming back, described well enough that you can recognise it in someone else's code and apply it in your own. Knowing the patterns gives you a shared vocabulary: "put a strategy there" says in three words what would otherwise take a diagram.

This topic starts with what a pattern is made of, the four elements the Gang of Four use to describe every one of their 23, and shows one pattern you already use in every language: the iterator behind a for loop. It then lays out the whole catalogue in its three families, connects the patterns to the SOLID principles they apply, and shows which of them Python's functions and modules make smaller or unnecessary.

It closes on the cost: a pattern used where no problem asks for it adds classes and protects against nothing. It does not teach any single pattern in depth; each one has a topic of its own.

By the end you can name a pattern's elements, sort a problem into its family, say which principle a pattern serves, and recognise a pattern that is not earning its place.

Contents

8 cardsnot started