Pure Danger Tech


Design patterns as language

19 Sep 2007

Cedric has a nice post up defending design patterns. I have personally been quite vocal in criticizing several popular patterns lately (see Singleton, Template Method, and Visitor), so I guess I bear a partial amount of the heat. I’ve tried in my posts (despite their inflammatory titles) to point out not really why the pattern sucks but more where it is commonly poorly applied (especially in Java) and how to address those problems with concrete suggestions. At least that was my goal. :)

I think patterns are important for no other reason than to serve as a language that developers can use to talk to each other. It’s so much easier to just say that something is a “factory” or that something uses “delegation” or a “proxy” or whatever. These things have meaning that has been fixed (to some degree) by GoF and for that we are ever indebted.

I also think GoF introduced not just the terms but also the way we can talk about design choices (in terms of opposing forces). For that, we are also greatly indebted. For me, this style of discussion is essential when discussing alternative designs as no design is “right” or “wrong”, they just take different priorities into account and it’s matter of trying to find the optimal solution that balances the forces according to the priorities.

I was actually going to do a presentation about this for No Fluff in a couple weeks but I didn’t have time to put it together. Maybe good for a future talk….