Re: Composition vs. Inheritance
Douglas Philips <[email protected]> Tue, 27 Feb 2007 09:12:17 -0500
| Newsgroups | gmane.comp.lang.lightweight |
|---|---|
| Message-ID | <[email protected]> |
On 2007 Feb 27, at 8:47 AM, Seth Gordon indited: > 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? It sounds like the contract/interface/encapsulation boundaries have not been defined very well? --Doug