[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Jon Harrop <jon@f...> |
| Subject: | Re: [Caml-list] when OO is wrong |
On Tuesday 31 March 2009 04:02:43 Martin Jambon wrote:
> Alexy Khrabrov wrote:
> > What is it about FP which makes modeling simpler than OO, conceptually
> > and technically? How can folks summarize their "enlightenment"
> > experiences in this regard?
>
> ...
> Objects and classes tend to be more appropriate than modules and records in
> the following cases:
>
> - self-centric data that can be considered as a "resource", typically for
> IO operations.
> - frequent need to define and use interfaces before implementations.
> - keeping familiar names for functions/methods without requiring
> disambiguation prefixes ("input", "output", "print", "flush", "read",
> "send", etc.)
I'd also add that OCaml's object system is great when you're developing code
and don't want to have to keep type definitions up to date as the code
evolves. For example, I used objects to represent LLVM's state in HLVM.
I also used an object to avoid introducing a huge mutual recursion in Smoke.
--
Dr Jon Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?e