From: Brian Hurt <bhurt@spnz.org>
To: David Brown <caml-list@davidb.org>
Cc: Richard Jones <rich@annexia.org>, <caml-list@inria.fr>
Subject: Re: [Caml-list] OCaml and Design Patterns
Date: Wed, 20 Oct 2004 14:31:11 -0500 (CDT) [thread overview]
Message-ID: <Pine.LNX.4.44.0410201416310.4934-100000@localhost.localdomain> (raw)
In-Reply-To: <20041020184714.GA25862@old.davidb.org>
On Wed, 20 Oct 2004, David Brown wrote:
> On Wed, Oct 20, 2004 at 06:30:01PM +0100, Richard Jones wrote:
>
> > Just my personal opinion, but I've seen a lot of terrible code written
> > which uses "design patterns" ... A lot of the patterns seem to exist
> > solely to bypass problems with OO languages.
>
> Design Patterns seem very similar to what is usually called idioms in other
> languages. They're just common constructs you learn for common tasks. An
> example in ocaml might be typical recursion for a loop.
>
> However, the OO Design Patterns do seem more to be techniques used to
> compensate for defects in the OO methodology, or specific languages.
>
> I would suspect that when someone encounters a place to use a design
> pattern in OCaml, the problem would much better be solved by using some
> other feature of the language.
>
I don't seem to have quite as negative a view of the GoF book as many
people around here seem to. But I think this is because I see design
patterns as a more general idea than just what the GoF presented- and I'd
argue this view is supported by the pattern community- as now you have
software architecture patterns, anti-patterns, etc. I think there are OO
patterns (which is what is documented in the GoF book), functional
patterns, even procedural patterns.
I also think that the difference between idioms and patterns is mainly a
matter of degree- they're all of a kind, if you see.
Note that there are a number of Functional patterns which are for working
around the limitations of the Ocaml language as well. An example I'll
hold up here is "build a list backwards, then reverse it" pattern, to make
a function tail recursive. Others are less clear cut- is "return the
update applicative structure" a work-around, or a better way of doing
things?
The point I'd like to make to the original poster is that the GoF isn't
the last word on how to think about problems, especially not in Ocaml.
Look for the new patterns Ocaml allows/encourages.
--
"Usenet is like a herd of performing elephants with diarrhea -- massive,
difficult to redirect, awe-inspiring, entertaining, and a source of
mind-boggling amounts of excrement when you least expect it."
- Gene Spafford
Brian
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
next prev parent reply other threads:[~2004-10-20 19:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-20 17:13 Vasili Galchin
2004-10-20 17:30 ` Richard Jones
2004-10-20 18:47 ` David Brown
2004-10-20 19:31 ` Brian Hurt [this message]
2004-10-21 8:56 ` pad
2004-10-21 10:31 ` [Caml-list] ocamaweb release 6.01 charles@laposte
2004-10-21 17:12 ` David Brown
2004-10-22 7:38 ` lehalle@miriad
2004-10-20 20:05 ` [Caml-list] OCaml and Design Patterns Vasili Galchin
2004-10-20 20:07 ` Vasili Galchin
2004-10-21 8:51 ` pad
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.44.0410201416310.4934-100000@localhost.localdomain \
--to=bhurt@spnz.org \
--cc=caml-list@davidb.org \
--cc=caml-list@inria.fr \
--cc=rich@annexia.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox