On Tue, Oct 08, 2002 at 05:49:33PM +0100, Simon Wistow wrote:
> On Tue, Oct 08, 2002 at 05:21:15PM +0100, Shevek said:
> > I disagree entirely. This gives the impression that one should consciously 
> > code from the book.
> 
> Au Contraire. If you don't understand the pattern properly *then* you'd
> be cut and pasting from the book. 

This is one of the points mjd conveyed in his talk.

First, the C++ code in the GoF is *not* the alpha and omega of design
patterns in programming.  Christopher Alexander had *MUCH* more to say
about pattern languages.  

Second, design patterns, especially in C++ and Java circles, tends
to mean cargo cult programming copying code out of the GoF by rote,
and modifying it slightly each time it's used.

Third, the Lisp community is very big on saying that design patterns
are irrelevant in Lisp.  They claim that 'design pattern' == 'idiom'.
They're half right; much of what the GoF are writing about are ways
to overcome the limitations of C++ and offer the same kind of
flexibility you could get from a few lines of simple Smalltalk or
Lisp.  But they're forgetting that just because the body of C++ patterns
isn't interesting in Lisp doesn't mean that there are universal and
local design patterns in Lisp.

In some respects, classic GoF design patterns don't mean a whole
helluva lot in Perl.  The iterator pattern for example is very weak
in the GoF and is very ably handled by idioms like foreach(), map {}, 
grep {} and while().  We don't *need* complex iterator classes/interfaces
in Perl because we have first class generic aggregates.  The iterator
pattern in Lisp is much more interesting, too, and does things that
aren't even raised in the GoF pattern.

That's not to say that design patterns have no place in Perl.  Just that
they're very different than the cargo cult GoF patterns. 

Z.


Reply via email to