http://www.perlmonks.org?node_id=193342


in reply to Are design patterns worth it?

Should I be concerned that my code doesn't fit the Gang of Four's vision of architectural sophistication?

Not necessarily.

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.

Replies are listed 'Best First'.
Re: Re: Are design patterns worth it?
by spiderman (Monk) on Aug 28, 2002 at 05:13 UTC
    Consider Design patterns as models whose basic structures can be altered to meet your design needs. I studied C++ Design Patterns some time ago- quite a bit before beginning to learn Perl. What I gained from them were concepts of how to conceptualy break large projects into modules whose basic concepts and purpose can be communicated in a manner that is easily understood by others. I have often found that although I come nowhere near meeting the design standards I dream of - that just the process of involving my peers in some discussion of patterns concepts stimulates our thinking use some of these concepts. Don't be so hard on yourself and remember "Cape does not enable user to fly". Spidey