Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: Are design patterns worth it?

by dws (Chancellor)
on Aug 28, 2002 at 02:55 UTC ( #193342=note: print w/replies, xml ) Need Help??

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

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://193342]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2018-06-21 05:49 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (117 votes). Check out past polls.