[Haskell-cafe] Design Patterns by Gamma or equivalent

minh thu noteed at gmail.com
Wed Mar 11 07:12:51 EDT 2009


2009/3/11 Mark Spezzano <mark.spezzano at chariot.net.au>:
> Hi,
>
>
>
> I’m very familiar with the concept of Design Patterns for OOP in Java and
> C++. They’re basically a way of fitting components of a program so that
> objects/classes fit together nicely like Lego blocks and it’s useful because
> it also provides a common “language” to talk about concepts, like Abstract
> Factory, or an Observer to other programmers. In this way one programmer can
> instantly get a feel what another programmer is talking about even though
> the concepts are fundamentally abstract.
>
>
>
> Because Haskell is not OO, it is functional, I was wondering if there is
> some kind of analogous “design pattern”/”template” type concept that
> describe commonly used functions that can be “factored out” in a general
> sense to provide the same kind of usefulness that Design Patterns do for
> OOP. Basically I’m asking if there are any kinds of “common denominator”
>  function compositions that are used again and again to solve problems. If
> so, what are they called?

Hi,

A particular instance of what can replace the idea of design pattern is given
by this now famous post :
http://blog.sigfpe.com/2009/01/haskell-monoids-and-their-uses.html

You'll see that what 'speaks' to the haskell programmers, maybe in the
same way you
say design patterns speak to another oo programmer, is much more fitted to the
language in haskell. At a lower scale, the reusability of some simple
functions like fold or map
is reflected at a higher scale by the reusability of concepts like
monoids (whih 'exist' in
the language, as type classes, while a pattern doesn't).

Cheers,
Thu


More information about the Haskell-Cafe mailing list