Ideas for a refactoring with traits?

Andreas Raab andreas.raab at gmx.de
Thu Sep 6 21:56:34 UTC 2007


Hernan Wilkinson wrote:
> Hi Andreas,
>  there are other guys (Claudio and Nicolas, they just sent and email 
> about traits browser) that are doing something quite similar to what you 
> suggest.
>  They will re-implement the Collection hierarchy using traits and 
> compare that model to the current Collection hierarchy to see if they 
> got a better model/implementation using traits or not.

But this isn't a particularly valid comparison. If you want to find out 
about the value of traits you can't compare a subsystem that is being 
used in production and that has all kinds of legacy issues with one that 
doesn't have to deal with such issues. What you are comparing then is: 
Is a subsystem which can be implemented free of constraints superior to 
one that has to accommodate all sorts of constraints and legacy issues? 
I can tell you the answer to that question without running the 
experiment. And it has nothing to do with traits.

So either you need to run the experiment within the same constraints 
that exist already (in which case you should do an in situ 
reimplementation of the collection hierarchy with the requirement of 
keeping the system running while doing it) or you need to implement both 
parts free of the constraints of the current system. Which are both fine 
options btw.

> I think that doing exactly what you suggest in this case is not easy 
> because there is a well accepted implementation of the Collection 
> hierarchy... we should look for another problem to apply your idea 
> without "noise"... I keep that in mind and offer your idea to other 
> students.

I think it is *very* easy to do what I proposed as long as you are clear 
what your goals for the refactorings are other than "use traits". If 
your goal is, for example, "minimize code duplication" it's clear how to 
do this without traits. If it is "minimize number of entities", it's 
clear, too. So is "restructure into more useful/generalized entities" or 
"unify the interfaces". As long as you are clear on what goals you're 
actually trying to achieve it's pretty clear how to achieve these goals 
with or without traits.

Cheers,
   - Andreas



More information about the Squeak-dev mailing list