[erlang-questions] "Design patterns" for functional languages?

Michael T. Richter ttmrichter@REDACTED
Thu Aug 7 04:17:10 CEST 2008

On Wed, 2008-08-06 at 14:15 -0700, Kevin Scaldeferri wrote:

> > I'm not sure I agree with the statement quoted by Michael that FP
> > doesn't have the shortcomings of OO so GoF-like patterns aren't
> > necessary.

> Yeah, functional programming has _different_ patterns, not no  
> patterns.  And, in some sense they also highlight shortcomings.

> For example, functional languages typically do not have lists that you  
> can append to efficiently, so we need the "Accumulate and Reverse"  
> pattern.

> Erlang doesn't allow you to enumerate the messages a process can  
> receive, so we have a "Hide Message-Passing Behind Functions" pattern.

These would fall more under the heading of "idioms" than GoF-style
patterns in my books (although the latter of the two is in the same grey
space I mention below).  The equivalent in C++, to contrast to the
GoF-style patterns, would be the use of auto_ptr in functions to make up
for C++'s lack of decent memory management.  Some of the GoF patterns
(I'm looking at you here, Singleton!) verge on the idiom level, but in
general they're architectural constructs, not coding tricks.

Michael T. Richter <ttmrichter@REDACTED> (GoogleTalk:
We should sell bloat credits, the way the government sells pollution
credits. Everybody's assigned a certain amount of bloat, and if they go
over, they have to purchase bloat credits from some other group that's
been more careful. (Bent Hagemark)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080807/5850069e/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080807/5850069e/attachment.bin>

More information about the erlang-questions mailing list