From: Jan Kybic <kybic@fel.cvut.cz>
To: caml-list@yquem.inria.fr
Subject: On the benefits of OO, Was: [Caml-list] C++/C# inheritance is bad?
Date: Fri, 16 Jan 2009 17:28:48 +0100 [thread overview]
Message-ID: <87d4enfc5b.fsf_-_@fel.cvut.cz> (raw)
In-Reply-To: <20090116155805.GA8664@annexia.org> (Richard Jones's message of "Fri, 16 Jan 2009 15:58:06 +0000")
> I have a more fundamental question: Is inheritence actually useful for
> anything? By which I mean, are there real world problems which are
> solved elegantly with inheritence which are otherwise difficult to
> solve? I'm not sure I've seen many. I have seen many very tortuous
> class hierarchies though.
>
Some personal thoughts:
I think the OO methodology is good for creating reusable components
and maintaining a clean interface between them.
I develop complex algorithms which consist of many building blocks.
Often, I need to try many variants before settling on a final
solution, sometimes there is not even any final solution - for each
subclass of a problem a different sub blocks might be appropriate.
It is a great time-saver if the building blocks can be swapped with as little
change in the code as possible.
The inheritance is then a convenient way of code reuse.
Code reuse is important because it avoids code duplication.
And code duplication is bad because it makes maintenance hard.
However, I am not using the OO features of Ocaml much, mainly because
of the speed penalty.
Jan
--
-------------------------------------------------------------------------
Jan Kybic <kybic@fel.cvut.cz> tel. +420 2 2435 5721
http://cmp.felk.cvut.cz/~kybic ICQ 200569450
next prev parent reply other threads:[~2009-01-16 16:29 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-16 15:18 Kuba Ober
2009-01-16 15:58 ` [Caml-list] " Richard Jones
2009-01-16 16:28 ` Jan Kybic [this message]
2009-01-17 12:40 ` On the benefits of OO, Was: " Oliver Bandel
2009-01-16 18:27 ` Raoul Duke
2009-01-16 21:42 ` Kuba Ober
2009-01-17 3:14 ` Sashan Govender
2009-01-17 14:07 ` Kuba Ober
2009-01-18 6:24 ` Stefano Zacchiroli
2009-01-17 13:27 ` Jon Harrop
2009-01-17 14:35 ` Kuba Ober
2009-01-17 16:59 ` Jon Harrop
2009-01-17 21:22 ` Kuba Ober
2009-01-17 22:17 ` Jon Harrop
2009-01-17 23:29 ` David Teller
2009-01-17 23:49 ` Jon Harrop
2009-01-19 16:22 ` Visitor in OCaml [was Re: [Caml-list] C++/C# inheritance is bad?] Yoann Padioleau
2009-01-19 16:41 ` blue storm
2009-01-19 17:49 ` Richard Jones
2009-01-19 17:52 ` Visitor in OCaml Christophe TROESTLER
2009-01-21 20:09 ` Yoann Padioleau
2009-01-22 4:03 ` [Caml-list] " Yaron Minsky
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=87d4enfc5b.fsf_-_@fel.cvut.cz \
--to=kybic@fel.cvut.cz \
--cc=caml-list@yquem.inria.fr \
/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