|Just another Perl shrine|
Re: Are design patterns worth it?by dws (Chancellor)
|on Aug 28, 2002 at 02:55 UTC||Need Help??|
Should I be concerned that my code doesn't fit the Gang of Four's vision of architectural sophistication?
Are design patterns all they're reported to be, or even close?
Yes, with caveats. (See Design Patterns Considered Harmful.)
Design patterns capture solutions to specific types of problems. The Gang of Four patterns are fairly generic. Additional, domain-specific patterns are also plentiful (witness the multi-volume Pattern Languages of Programming (PLOP) series.) The generic patterns are a good thing to know, because they do affect the way you look at design, in the same way that having a big bag of programming tricks can help you implement. Many of the GoF patterns are really not that sophisticated, but they do depend on structuring your code into classes. Depending on what you're doing, that might be overkill.
Is their scale [< 2000 lines] too small for pattern-based design to make an appreciable difference?
Not at all, though it depends on whether you have a problem that a pattern helps you solve. I regularly use the "Strategy" pattern on medium sized (~1000 line) scripts, but that's because a couple of things I like to do are natural candidates for strategies.