Design patterns don’t have to suck

« »

Design patterns suck. This is a cold hard truth faced by many developers. They’d rather ahve their teeth extracted by a sadistic dentist who uses cayenne peppers instead of Novocaine than try and implement the Abstract Factory or the Mediator Pattern. And can you blame them? Reading the Gang of Four Design Patterns book is about as exciting as being hit over the head with a mallet. Seriously, that thing could double as a sleeping pill; it should carry a “Do not operate heavy machinery” label.

Sure, you might think “I’ll pick up a copy of X instead.” But if you write in pretty much any language besides Java, you’re out of luck on the code examples. Maybe, if you’re lucky, maybe you can understand them. But for most of us, we look at Java and our eyes glaze over. And we start dreaming of that dentist again.

And so, most developers spend their lives avoiding design patterns. And that’s really a shame. Because design patterns don’t have to suck. In fact, design patterns are a miraculously freeing tool that lets us stop worrying about how we’re going to accomplish something, and lets us get it done instead. Someone has already solved your problem! How liberating!

But there’s still that fun task of learning design patterns. How to go about it? That dull, thick book by the Gang of Four? Outdated books written for PHP 4 with a copyright of 2005? Some 515 page monolith on every object oriented topic ever? That’s no picnic.

Now there’s another option. In December, I’ll be sharing Practical PHP Design Patterns. This is my latest book, and it’s all about how you can use design patterns to make your life better. No more flipping through hundreds of pages to find the one you need, or reading through dull, dense copy written by professors. This book is all about giving you the information you need, when you need it, and in a format you can understand. It’s new, and it’s relevant, and it’s up to date.

On December 3rd, you can get a sneak peak of the book with a free chapter, but you have to be signed up to receive it! I’ve been working on this for about six months, and I’m really excited to share it with you.

Get a sneak peak at Practical PHP Design Patterns!

* indicates required

Brandon Savage is the author of Mastering Object Oriented PHP and Practical Design Patterns in PHP

Posted on 11/20/2013 at 7:00 am
Categories: PHP

KingCrunch wrote at 11/20/2013 7:12 am:

> In fact, design patterns are a miraculously freeing tool
> that lets us stop worrying about how we’re going to accomplish
> something, and lets us get it done instead.

Even better: It helps building up a common vocabulary :)

Brandon Savage (@brandonsavage) wrote at 11/20/2013 4:04 pm:

Vocabulary is important, but it’s not the only thing. I think having the tools is more important.

marun wrote at 11/21/2013 1:39 am:

This is one of those articles which are hard for me to read. Sorry. I know you are excited about your new book, but when you are advertising it make it less aggressive.

When I was reading Gang of Four book about patterns I was taken captive. For a first time it took me three days to read whole book. I have read it many more times since then. I’m not saying that Design Patterns are easy to read, but topic is complicated. I have seen so many times when Singleton is someones favorite pattern that I couldn’t count.

Design patterns are concepts of code interaction not a tool. Tool is something which you can grab and use. Design patterns are ideas you could apply to your tool (programming language) which makes your life/program/maintenance/whatever easier.

To make an analogy to hammer and nail. When you are using hammer it doesn’t matter which part of it you use to nail. Here comes pattern (good practice which allows you to do it faster and better), when you are nailing you should use face to nail.

I’m using abstract factory pattern over and over again (mediator, bridge, proxy, etc also). I have even used constructions such as abstract factory of abstract factory (no I’m not talking about Java).

Aaron Saray (@aaronsaray) wrote at 11/21/2013 5:16 pm:

I have to agree with @marun – the idea that PHP programmers would be bored or upset with reading about all this “really boring” computery stuff is kind of insulting. My team and I implement design patterns all the time – and half of them have read/loved GoF. The other half have read this book: — (Sorry – this looks like self promotion, it’s not). Yeah it’s from 2009, but it uses PHP5 and has examples of PHP5 OO code.

Anyway, I support what you’re doing, I think it’s good to get people excited about using proper concepts in PHP, but be careful not to disparage the great people who have come before you. :)

« »

Copyright © 2024 by Brandon Savage. All rights reserved.