The Pattern Zoo

I finally picked up the Design Patterns book!

In the spirit of producing my own learning exhaust, I thought it would be pretty neat if I used the On Writing Code project as a place where to share what I learn about…writing code, but in a more structured way than a blog.

Zoo examples are a weak shortcut

Design Patterns is a book really well written, and it does explain the concepts really well, but I think there’s room for improvement in the examples that the book provides, as they’re too abstract:

class Dog extends Animal {}

I’m a strong believer in learning from example because you learn the concept and see an example of how it can be implemented at the same time. It’s a learning multiplier.

For an experienced engineer, talking in terms like “A Duck is a bird” or “Coffee Order may have many types of coffee” might seem easier, but I think it’s only easier for someone to communicate information outwards, not for the person consuming that information.

Examples like class Animal seem just fine if you’re explaining a new concept to a colleague and you need to use a quick, dumb example to help you communicate. But when teaching how to improve writing code, I think abstracted ideas aren’t that good.

In search of design patterns

And then I started searching for better examples online, and to my amazement, most of the examples I find - I can pin to one of two sources - either the Design Patterns book or and maybe a few that use “The Zoo”.

All of those sources use different abstract language to explain the same information, but the rest of the internet is regurgitating the same examples in the same way over and over again.

I think this is a real shame. For someone who’s trying to learn a novel concept - seeing many different examples is what drives learning. Finding the same dull abstract examples over and over isn’t particularly helpful.

This is the best validation for why I should be working on the On Writing Code idea that I’ve received so far. It’s a clear way I can produce value, by creating a resource that I wish I had. At the same time, I get to learn a lot about design patterns myself. It’s the win-win multiplier that I’ve been looking for.

Time to start reworking that site. 🔥