Le Vendredi 4 Août 2006 10:34, Frank Schönheit - Sun Microsystems Germany a 
écrit :
> Hi Éric,

Hi Frank,

(I agree with almost everything you say, so I will answer only one or two 
single points here)

> > I feel there's also a danger to bloat your software by composing too much
> > functionality, and perharps even leading to duplication of functionality.
>
> At least the latter (I'm not sure about the former) is, IMO, a problem
> of lazyness. If you duplicated code, you did something wrong. Looking at
> existing code, this, once more, is definately no problem of composition.
> I'm often ... astonished how easily people seem to just
> copy-paste-modify code, instead of putting a common base in there.

Well, what's the point of reusability if you can not simply assemble (or 
derive) classes by an operation as simple as a cut or past. Same goes even 
for old procedural programming. If you have to study the code of all the 
stuff you assemble / derive / call, you can't really all that reusability.

To some extent, you have to be able to see software components as "black 
boxes" known only through their external declarations and their documentation 
(and yes, that does not depend on on your programming paradigms). 

The specific problem with composition (and multiple inheritance) is that it's 
very easy to assemble class A and class B that both derive from a common 
class C, therefore leading to duplication at least of variables. Or that 
class A and class B have both methods for more or less the same idea.

That's due to the fact that composition behaves like a logical OR while 
inheritance behaves like a logical AND (between classes).

> > Sometimes when I look of some code in OOo I get the impression "oh, 90%
> > of this class might not be used.
>
> This might/not be true, but again, what does this have to do with
> "composition vs. inheritance"? :)

Because you usually reuse things way too strong for your needs.


-- 
Mais s'inscrire dans la logique du combat contre l'"axe du Mal" était une 
gageure. Ce crédo américain, d'origine religieuse,  a échoué en Irak. Et 
maintenant, il mène Israèl, qui s'érige en défenseur de la "civilisation 
occidentale", dans l'impasse. -- Esther Benbassa, École pratique des hautes 
études.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to