Version française
Home     About     Download     Resources     Contact us    
Browse thread
C++/C# inheritance is bad?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jan Kybic <kybic@f...>
Subject: On the benefits of OO, Was: [Caml-list] C++/C# inheritance is bad?
> 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