When should I use—and not use—design patterns?

Posted by ashmish2 on Programmers See other posts from Programmers or by ashmish2
Published on 2011-02-18T11:18:38Z Indexed on 2012/10/31 23:16 UTC
Read the original article Hit count: 498

Filed under:

In a previous question of mine on Stack Overflow, FredOverflow mentioned in the comments:

Note that patterns do not magically improve the quality of your code.

and

Any measure of quality you can imagine. Patterns are not a panacea. I once wrote a Tetris game with about 100 classes that incorporated all the patterns I knew at the time. Why use a simple if/else if you can use a pattern? OO is good, and patterns are even better, right? No, it was a terrible, over-engineered piece of crap.

I am quite confused by these comments: I know design patterns help to make code reusable and readable, but when should I use use design patterns and perhaps more importantly, when should I avoid getting carried away with them?

© Programmers or respective owner

Related posts about design-patterns