Pattern Apocalypse

Clean Code, Episode 34

By Robert C. Martin

82 minJul 2015

This is the Pattern Apocalypse! The final episode about design patterns. And it's a doosy!

In this episode we're going to talk about five patterns:

  1. Bridge
  2. Chain of Responsibility
  3. Interpreter
  4. Iterator
  5. Adapter

You're going to love the discussion about the Bridge pattern. In it, I show you how to break down an subtype hierarchy with multiple degrees of freedom into a chain of several subtype hierarchies capturing one degree of freedom each.

In the Chain of Responsibility discussion we extend those hierarchies so that clients have no idea what server is serving them.

Then we explore Greenspun's 10th law by looking at the Interpreter pattern. And we learn that with great power comes great responsibility; and that most efforts to reduce programming workload by shifting it to the business simply cause that workload to bounce back to the programmers.

You're going to find the Iterator discussion particularly interesting. It's not what you think it is. This discussion will teach you how to turn loops inside out so that the loops are at the bottom, being driven by the algorithm, instead of at the top and driving the algorithm.

And then, at long last, the humble Adapter pattern. I'll go through a little history about comp.object discussions, and table lamps, and interface naming. And then we'll explore the two primary forms of the Adapter.

So, if you're ready, it's time to dive in to the final set of Design Patterns. Fire up the Pattern Apocalypse!