On Feb 3, 2010, at 4:43 PM, Mariano Martinez Peck wrote:

> 
> 
> On Wed, Feb 3, 2010 at 4:34 PM, Chris Muller <asquea...@gmail.com> wrote:
> 
> 4) I have refactored DirectoryEntry to no longer inherit from
> ArrayedCollection.  Is this an improvement with any community
> interest? 
> 
> Do you think this is interesting ?   What are the benefits of such change ? 
> 
> Jannik: do we kill a cycle dependency or something with this change ?
> 

You should never inherit from collections. The problem is that with this, you 
are depending
on the internal working of the collection.

Especially objects that model a domain object (like a Directory related thing) 
should *never*
inherit from a collection. Only if you need a special *kind* of collection 
(technically), it might be
interesting to do a subclass of a collection (see MethodDictionary).

If you need a collection, you *use* a collection.  (you put a standard 
collection as an instance var).

It's very tempting to use inheritance to aquire behavior. But in most cases, it 
is wrong to use it.

You can see this abuse of inheritance very often in Squeak... e.g. Scanner is 
the superclass of
Parser, there are subclasses of SystemWindow (!!), things like that. Bad.


        Marcus

--
Marcus Denker  -- http://www.marcusdenker.de
INRIA Lille -- Nord Europe. Team RMoD.


_______________________________________________
Pharo-project mailing list
Pharo-project@lists.gforge.inria.fr
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to