Re: Composition vs. Inheritance

Robbert Haarman <[email protected]> Tue, 27 Feb 2007 15:21:27 +0100
Newsgroups gmane.comp.lang.lightweight
Message-ID <[email protected]>
On Tue, Feb 27, 2007 at 08:47:38AM -0500, Seth Gordon wrote:
> Robbert Haarman wrote:
> > So, a better solution would have been to implement just the basic 
> > operations (e.g. add) as part of the class definition, and the higher 
> > level operations in terms of the basic ones. That way, it would have 
> > been clear that you need have overridden only add.
> 
> But what if you have a more efficient way of implementing #addAll than
> simply iterating through the members of the collection being added?

Then it would seem you have a trade-off between elegance, composibility 
and programmer time on the one hand, and run time performance on the 
other.

Regards,

Bob

-- 
"Cross platform apps are like unisex underwear."
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFF5D5nfb9wcmD+WN4RAsa5AJ4r5yyXL3lL9RYRUUSVHqDbBhF6VACgh5g5
1VE3VRw/b1q2ncrrPb1j/sE=
=tWQN
-----END PGP SIGNATURE-----