About pushBack:

nicolas cellier ncellier at ifrance.com
Sun Aug 5 19:31:28 UTC 2007


Jason Johnson a écrit :
> Oh, and I forgot to mention:
> 
> I don't personally see traits as something that comes up that often.  
> 99% of the time inheritance, or some OO pattern gives the best 
> solution.  But in that 1% something like a trait is the correct solution 
> and not having it shows up a design wart.
> 
> Personally the thing that stuck out to me in my travels through the 
> Squeak image was just the Magnitude class.  I personally think that 
> should just be a trait.  In fact I would see at least equality and 
> comparability as separate traits.  By having it be a class causes 
> certain design warts [1] imo.
> 
> [1]  In the case where a class should really inherit somewhere else you 
> either have to inherit from Magnitude and duplicate the other code, 
> inherit from the correct class and duplicate the Magnitude code or 
> change the highest class in your hierarchy to inherit from Magnitude 
> instead of Object.  These solutions are all code smell imo.
> 
> 
> ------------------------------------------------------------------------
> 

Very true.
Try to extend algebra with matrices, vector space, or symbolic 
computation, and you will see that simple inheritance makes it hard to 
avoid duplications.
This makes me think of axiom which has a separate hierarchy for 
inheriting mathematical properties...

Nicolas




More information about the Squeak-dev mailing list