* [Caml-list] OCaml and Design Patterns @ 2004-10-20 17:13 Vasili Galchin 2004-10-20 17:30 ` Richard Jones 2004-10-21 8:51 ` pad 0 siblings, 2 replies; 11+ messages in thread From: Vasili Galchin @ 2004-10-20 17:13 UTC (permalink / raw) To: caml-list [-- Attachment #1: Type: text/plain, Size: 519 bytes --] Hello, I am working on a C++ project (hey I have to make money ... I personally hate the language) so I am using Design Patterns. In the standard GoF book (Gang of Four design pattern book), the authors say that some patterns already exist (builtin) in some languages. What design patterns do you think would be useful if I am using the OO features of OCaml (i.e. non-pure functional features)? Thanks, vasili --------------------------------- Do you Yahoo!? vote.yahoo.com - Register online to vote today! [-- Attachment #2: Type: text/html, Size: 621 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Caml-list] OCaml and Design Patterns 2004-10-20 17:13 [Caml-list] OCaml and Design Patterns Vasili Galchin @ 2004-10-20 17:30 ` Richard Jones 2004-10-20 18:47 ` David Brown ` (2 more replies) 2004-10-21 8:51 ` pad 1 sibling, 3 replies; 11+ messages in thread From: Richard Jones @ 2004-10-20 17:30 UTC (permalink / raw) Cc: caml-list [-- Attachment #1: Type: text/plain, Size: 1031 bytes --] On Wed, Oct 20, 2004 at 10:13:01AM -0700, Vasili Galchin wrote: > Hello, > > I am working on a C++ project (hey I have to make money ... I > personally hate the language) so I am using Design Patterns. In the > standard GoF book (Gang of Four design pattern book), the authors say > that some patterns already exist (builtin) in some languages. What > design patterns do you think would be useful if I am using the OO > features of OCaml (i.e. non-pure functional features)? 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. Rich. -- Richard Jones. http://www.annexia.org/ http://www.j-london.com/ Merjis Ltd. http://www.merjis.com/ - improving website return on investment "One serious obstacle to the adoption of good programming languages is the notion that everything has to be sacrificed for speed. In computer languages as in life, speed kills." -- Mike Vanier [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Caml-list] OCaml and Design Patterns 2004-10-20 17:30 ` Richard Jones @ 2004-10-20 18:47 ` David Brown 2004-10-20 19:31 ` Brian Hurt 2004-10-20 20:05 ` [Caml-list] OCaml and Design Patterns Vasili Galchin 2004-10-20 20:07 ` Vasili Galchin 2 siblings, 1 reply; 11+ messages in thread From: David Brown @ 2004-10-20 18:47 UTC (permalink / raw) To: Richard Jones; +Cc: caml-list 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. Dave ------------------- 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 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Caml-list] OCaml and Design Patterns 2004-10-20 18:47 ` David Brown @ 2004-10-20 19:31 ` Brian Hurt 2004-10-21 8:56 ` pad 0 siblings, 1 reply; 11+ messages in thread From: Brian Hurt @ 2004-10-20 19:31 UTC (permalink / raw) To: David Brown; +Cc: Richard Jones, caml-list 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 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Caml-list] OCaml and Design Patterns 2004-10-20 19:31 ` Brian Hurt @ 2004-10-21 8:56 ` pad 2004-10-21 10:31 ` [Caml-list] ocamaweb release 6.01 charles@laposte 0 siblings, 1 reply; 11+ messages in thread From: pad @ 2004-10-21 8:56 UTC (permalink / raw) To: Brian Hurt; +Cc: David Brown, Richard Jones, caml-list Brian Hurt <bhurt@spnz.org> 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 ^ permalink raw reply [flat|nested] 11+ messages in thread
* [Caml-list] ocamaweb release 6.01 2004-10-21 8:56 ` pad @ 2004-10-21 10:31 ` charles@laposte 2004-10-21 17:12 ` David Brown 0 siblings, 1 reply; 11+ messages in thread From: charles@laposte @ 2004-10-21 10:31 UTC (permalink / raw) To: caml-list A new version (6.01) of OCAMAWEB is available at sourceforge : http://sourceforge.net/project/showfiles.php?group_id=66639 It's a litterate programming tool written in ocaml and that can be used on any language having comment marks of one character (I deeply think about an upgrade to *any* language). It is used for more that 2 years at MIRIAD Technologies, where it is used to comment algorithmic code. config files exist for awk and r-project languages, and I will soon tune one for the SAS macro programming language. feel free to use, read and comment the code (It is based on my first ocaml experience, so I know that I should build a fully new version as soon as possible : advices are welcome...). charles -- Charles-Albert LEHALLE charles@lehalle.net keyserver: http://pgp.mit.edu/ Such is the advantage of a well constructed language that its simplified notation often becomes the source of profound theories. In N. Rose de Laplace, Pierre-Simon (1749 - 1827) In Mathematical Maxims and Minims, , Raleigh NC:Rome Press Inc., 1988. ------------------- 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 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Caml-list] ocamaweb release 6.01 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 0 siblings, 1 reply; 11+ messages in thread From: David Brown @ 2004-10-21 17:12 UTC (permalink / raw) To: charles; +Cc: caml-list On Thu, Oct 21, 2004 at 12:31:36PM +0200, charles@laposte wrote: > It's a litterate programming tool written in ocaml and that can be used on > any language having comment marks of one character In other words, it can't be used with Ocaml, C, C++, Java, Ada, Haskell? So it is a literate tool for scripting languages such as sh, perl and python? Dave ------------------- 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 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Caml-list] ocamaweb release 6.01 2004-10-21 17:12 ` David Brown @ 2004-10-22 7:38 ` lehalle@miriad 0 siblings, 0 replies; 11+ messages in thread From: lehalle@miriad @ 2004-10-22 7:38 UTC (permalink / raw) To: caml-list On Thu, 21 Oct 2004 10:12:48 -0700, David Brown <caml-list@davidb.org> wrote: >> any language having comment marks of one character > In other words, it can't be used with Ocaml, C, C++, Java, Ada, Haskell? > So it is a literate tool for scripting languages such as sh, perl and > python? MATLAB, SAS and S-plus were the target of OCAMAWEB (for signal processing and probability/statistics algorithms prototyping, in which it is very valuable to include mathematical proofs into code), so I at the time I developed ocamaweb, I did not think that it could be usefull for the languages you cite. Now that a lot of people use ocamaweb outside of MIRIAD, I will have to extend it to any language... Anyway, from my point of view, there is a lot of tools to comment code a proper way (doxygen, ocamldoc, etc), and a lot of programming tasks do not need "real" litterate programming (in java for instance, a "linear" documentation tool like javadoc is mainly efficient). The point is that when you develop code that implement some mathematical results you obtain and when you want to share that code (and the mathematics that support it) with other people (that's our case inside MIRIAD), you need to be able to "reconfigure" your code to produce a documentation including mathematical glyphs (using LaTeX is a good option) : that's what ocamaweb allow to obtain. And a lot of people implement such mathematical "adjustments" of existing results in signal processing and statistics / probability ; those people mainly use MATLAB, S-plus (or R) and SAS. So ocamaweb primary goal is definitely not to comment sh, perl or awk (even if now that it is on my computer, I use it with those languages) ; it's to produce restructured documentation including mathematical proofs. charles ------------------- 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 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Caml-list] OCaml and Design Patterns 2004-10-20 17:30 ` Richard Jones 2004-10-20 18:47 ` David Brown @ 2004-10-20 20:05 ` Vasili Galchin 2004-10-20 20:07 ` Vasili Galchin 2 siblings, 0 replies; 11+ messages in thread From: Vasili Galchin @ 2004-10-20 20:05 UTC (permalink / raw) To: Richard Jones; +Cc: caml-list [-- Attachment #1: Type: text/plain, Size: 1343 bytes --] Richard Jones <rich@annexia.org> wrote: On Wed, Oct 20, 2004 at 10:13:01AM -0700, Vasili Galchin wrote: > Hello, > > I am working on a C++ project (hey I have to make money ... I > personally hate the language) so I am using Design Patterns. In the > standard GoF book (Gang of Four design pattern book), the authors say > that some patterns already exist (builtin) in some languages. What > design patterns do you think would be useful if I am using the OO > features of OCaml (i.e. non-pure functional features)? 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. ^^^^ Rich, in the case of C++ I would totally agrere with you! Vasya Rich. -- Richard Jones. http://www.annexia.org/ http://www.j-london.com/ Merjis Ltd. http://www.merjis.com/ - improving website return on investment "One serious obstacle to the adoption of good programming languages is the notion that everything has to be sacrificed for speed. In computer languages as in life, speed kills." -- Mike Vanier > ATTACHMENT part 2 application/pgp-signature name=signature.asc __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com [-- Attachment #2: Type: text/html, Size: 1625 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Caml-list] OCaml and Design Patterns 2004-10-20 17:30 ` Richard Jones 2004-10-20 18:47 ` David Brown 2004-10-20 20:05 ` [Caml-list] OCaml and Design Patterns Vasili Galchin @ 2004-10-20 20:07 ` Vasili Galchin 2 siblings, 0 replies; 11+ messages in thread From: Vasili Galchin @ 2004-10-20 20:07 UTC (permalink / raw) To: Richard Jones; +Cc: caml-list [-- Attachment #1: Type: text/plain, Size: 1343 bytes --] Richard Jones <rich@annexia.org> wrote: On Wed, Oct 20, 2004 at 10:13:01AM -0700, Vasili Galchin wrote: > Hello, > > I am working on a C++ project (hey I have to make money ... I > personally hate the language) so I am using Design Patterns. In the > standard GoF book (Gang of Four design pattern book), the authors say > that some patterns already exist (builtin) in some languages. What > design patterns do you think would be useful if I am using the OO > features of OCaml (i.e. non-pure functional features)? 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. ^^^^ Rich, in the case of C++ I would totally agrere with you! Vasya Rich. -- Richard Jones. http://www.annexia.org/ http://www.j-london.com/ Merjis Ltd. http://www.merjis.com/ - improving website return on investment "One serious obstacle to the adoption of good programming languages is the notion that everything has to be sacrificed for speed. In computer languages as in life, speed kills." -- Mike Vanier > ATTACHMENT part 2 application/pgp-signature name=signature.asc __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com [-- Attachment #2: Type: text/html, Size: 1625 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Caml-list] OCaml and Design Patterns 2004-10-20 17:13 [Caml-list] OCaml and Design Patterns Vasili Galchin 2004-10-20 17:30 ` Richard Jones @ 2004-10-21 8:51 ` pad 1 sibling, 0 replies; 11+ messages in thread From: pad @ 2004-10-21 8:51 UTC (permalink / raw) To: Vasili Galchin; +Cc: caml-list Vasili Galchin <vasiliocaml@yahoo.com> writes: > Hello, > > I am working on a C++ project (hey I have to make money ... I > personally hate the language) so I am using Design Patterns. In > the standard GoF book (Gang of Four design pattern book), the > authors say that some patterns already exist (builtin) in some > languages. yes, have a look at : http://www.norvig.com/design-patterns/ > What design patterns do you think would be useful if > I am using the OO features of OCaml (i.e. non-pure functional > features)? I don't really understand the question because in theory all the design pattern are useful. So abstract factory can be useful in O'Caml too. Stragegy is useful too but easier in O'Caml since higher order function allow to encode easily the strategy pattern. There is discussion in the O'Caml manual about the observer pattern at: http://caml.inria.fr/ocaml/htmlman/manual007.html (section 5.3) Hope it helps. > > Thanks, vasili > > > --------------------------------- > Do you Yahoo!? > vote.yahoo.com - Register online to vote today! ------------------- 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 ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2004-10-22 7:38 UTC | newest] Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2004-10-20 17:13 [Caml-list] OCaml and Design Patterns Vasili Galchin 2004-10-20 17:30 ` Richard Jones 2004-10-20 18:47 ` David Brown 2004-10-20 19:31 ` Brian Hurt 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
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox