From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id KAA16989; Thu, 21 Oct 2004 10:57:27 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id KAA16862 for ; Thu, 21 Oct 2004 10:57:25 +0200 (MET DST) From: pad@ryxa.irisa.fr Received: from ryxa.irisa.fr (ryxa.irisa.fr [131.254.50.45]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id i9L8vPMt021837 for ; Thu, 21 Oct 2004 10:57:25 +0200 Received: (from pad@localhost) by ryxa.irisa.fr (8.11.6/8.11.6) id i9L8uwh30657; Thu, 21 Oct 2004 10:56:58 +0200 To: Brian Hurt Cc: David Brown , Richard Jones , caml-list@inria.fr Subject: Re: [Caml-list] OCaml and Design Patterns Reply-To: padiolea@irisa.fr References: Date: 21 Oct 2004 10:56:58 +0200 In-Reply-To: Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Miltered: at concorde with ID 417779F5.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 2004:99 terrible:01 idioms:01 recursion:01 haskell:01 developped:01 haskell:01 idioms:01 applicative:01 work-around:01 reinvent:01 ocaml:01 ocaml:01 supported:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Brian Hurt writes: > 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 totally agree with you. In fact the haskell community have developped design patterns at: http://www.haskell.org/hawiki/CommonHaskellIdioms They have adapted the idea of GoF to push it further cos in functionnal langage the main ideas of the GoF book were already known/used by the fp community. > > 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. People generally disrespect the work done by other communities (and then reinvent it giving it another name). ------------------- 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