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


in reply to "Perl Design Patterns"

A design pattern is a way of using components; that's why design patterns are not components of languages.

You might come up with a "language" consisting of mortar and bricks of various sorts. The design patterns would be the various common ways of arranging bricks to achieve various results. For example, when building a freestanding brick wall, you'll see some bricks sideways, to tie two layers together.

Cliches, aka idioms, are standard bits of code, such as open ... or die $! in Perl, or while( (c=getchar()) == 0 ) in C. Design patterns are both more complex and more abstract than these.

One simple design pattern is the use of an object, the iterator to traverse an array or linked list, rather than coding a loop. You could not make an iterator a part of a language in the sense that while loops or exceptions can be. If you have a library of data structures, as Java & C++ do, you can implement iterators as part of that.

--
TTTATCGGTCGTTATATAGATGTTTGCA