Design Patterns II

Remember my previous post about design patterns? Me neither, I wasn’t even sure I’d written one. Anyhow, here’s a bit of a brain dump on them, a result of a conversation I had the other day. When discussing the merits of design patterns, I pretty quickly concluded that they were about 90% bullshit, and was left having to justify that exclamation.

The thing is, a design pattern is a name and description given to a certain technique in software development. In layman’s terms, the “Hammer” design pattern might be described as “using a blunt, heavy object to pound onto the blunt end of a smallish, thin object with one pointy side, to drive that side into a suitably soft surface”. Note that there’s no mention of using a hammer, nails, nor does the description include the various uses of nails, such as holding two pieces of material together or serving as a hook to hang pictures on.

Imagine handing that description to someone who’s never seen a tool being used, much less used one themselves. Do you think they’ll be able to drive a nail into a wall?

If you think back to your childhood, I’m sure you used many, many attempts involving a lot of bent-out-of-shape nails before you could with any decent success rate. And unless you happen to work with hammers and nails regularly, I’m fairly certain you’ll still end up occasionally with slightly bent or wobbly nails, or nails at slightly the wrong angle.

It takes practice to understand the intricacies of something as simple as using a hammer well. In the same way, it takes practice to write software that performs well, is easily maintainable, and succinct.

If you teach a CS student about design patterns, that’ll be interesting and somewhat useful knowledge, but it’ll take the student somewhere between two and five years of software development experience to fully appreciate the knowledge. Teach someone who didn’t learn about design patterns at university, but who has between two and five years of experience about them, and they’ll likely say they were using them all along, just didn’t know they had a name.

I’m willing to bet that knowing about the names earlier on doesn’t shorten the timespan required to become a good programmer.

All of this doesn’t mean that it’s not useful to have a name for this stick-with-a-shaped-metal-block-at-it’s-end. But that’s about as useful as it gets… unless you’re in the business of selling qualifications to underpaid professionals.