On Fri, May 16, 2008 at 12:00 PM, Norbert Hartl norbert@hartl.name wrote:
If you like to have an example look at the collections hierarchy. That is a perfect example for that. These are full of "diamond problems". And what options do you have to solve it? Here my top approaches (worst first):
- code duplication. Don't need to comment that
- delegation. Adds a lot of one line methods. Code is growing and is
error prone
- moving implementation up the hierarchy. This leads to something like
ArrayedCollection>>add: newObject self shouldNotImplement
- traits. Not easy to understand and adds complexity
For a discussion about these questions and the Stream hierarchy, have a look at «Traits at Work: the design of a new trait-based stream library» http://www.iam.unibe.ch/~scg/Archive/Papers/Cass08a-NileNewKernel-ComputerLa.... Here, we identify all problems with the current Stream hierarchy, design a new one based on traits and discuss the differences and drawbacks.