Making Your Own Patterns

Every team repeats its own solutions. Notice them, name them, write them down, and share them.

Updated

Your Own Patterns

  1. When Repetition Becomes a Pattern: The Rule of Three (Journeyman): When the same solution turns up for the third time, each copy a little different, it's time to pull out its shared shape and give it a name; once is code, twice is a coincidence, and three times is a pattern worth naming, which is how every pattern in this course began.
  2. Writing a Pattern Card Your Team Will Read (Journeyman): A shared solution that nobody knows about, or knows when to use, gets copied around anyway; a pattern card says on one page what problem it solves, how to use it, when to skip it and where it's already used, so a teammate can pick it up without asking.
  3. A Team Pattern Catalog: Adding, Changing and Retiring (Freelancer): Once a team has a handful of pattern cards, they drift: two contradict, one describes how things used to be done, and new teammates copy whatever they find first; a catalog keeps every card in one place with a status, changes cards through review with a short decision record, and retires old patterns without deleting them.

Talking About Patterns

  1. Patterns in Code Reviews and Interviews (Journeyman): Naming a pattern in a code review helps only when it comes with the problem and is said kindly, and naming one in an interview counts only when it comes with a real story; this lesson shows how to do both, so the names you've learned make you easier to work with.

Where to Go Next

  1. Where to Go Next (Novice): A look back at what you can now do with design patterns, a last task that finds patterns in code you already use, and how to keep the patterns, and your own, working for you.

Exercise: Name Your Own Pattern

  1. Exercise: Name Your Own Pattern (Freelancer): Take a ticket from Summit Gym's front-desk team: three spreadsheet importers are near-copies, and a fourth team needs one too. Pull out their shared shape so the new importer is a few lines, keep all three importers' tests green, and write the pattern's card in the README.