The Gang of Four is wrong and you don't understand delegation (2012)
Published on: 2025-05-29 17:43:09
The Gang of Four got it wrong. Ruby's standard library has it wrong. Rails has it wrong.
Is it still wrong if everyone is doing it?
Yes.
The Gang of Four book Design Patterns gives us common vocabulary to understand basic patterns in Object-oriented programming. It helps all of us use the same terms when discussing our software and prevents confusion.
Sadly, this book seems to cause a whole hell of a lot of confusion.
They say "prefer composition over inheritance." That's great, there's good reason for that.
They say to use "delegation." That's great. Although there's not a single example of delegation in their book.
Delegation is a technique often cited as a way to create flexibility in your programs. That is to say, delegation is often given as the way to composition.
But delegation isn't what you think it is. The Gang of Four have lead you astray.
Worse still, almost every reference you'll find for "delegation" shows you examples of just object collaboration with message fo
... Read full article.