Monday, 30 July 2007

Pattern overkill

In my previous entry I've written about abstract factories. I've written how to choose a specific concrete factory. So that's a strategy, isn't it? It wouldn't be correct to use a single strategy; you should leave the door ajar to use different strategies, so you should use an abstract factory to create these strategies...

And that's when you become the next Iran since a fly is near, you need to kill it, and a nuclear bomb is the sure way to go (a cockroach would be a different issue, though).

Joel Spolsky called this Architecture Astronauts. Daniel Alonso said "If something is simple, just do it". Of course, talk is cheap; I have to do a full disclosure: sometimes I've done useless patterns, just for using patterns' sake. I guess every programmer does the same from time to time, and somebody who has just learnt patterns does it all the time. My latest example is that I've created an abstract factory, with a complex class hierarchy for instantiating 16 different types of objects from an "Indestructible" database, so I can easily add new classes whenever they add a new object types. Which last happened in 2001.
In a related note, a building from a Spanish electric utility has its floor numbers projected, instead of using copper numbers. I guess whenever they want to add a new floor between two, it's one less thing to think about.


Add to Technorati Favorites

No comments: