On 24 October 2010 16:26, Rajarshi Guha <email@example.com>
I think this idea is good, but I'm a little confused. Say RingSet
implemented List<T>, rather than extending ArrayList<T>. The RingSet
class would then have to implement the as much of the List interface
as needed - but the implementation may or may not be thread safe,
synchronized etc. So for each type of List implementation, I'd have to
Not necesarily, you might have one single abstract wrapper, as the one attached in my previous email and only have single method (createList ) that differs. This could be done with mechanism similar to ChemObjectBuilders, or just anonymous classes.
My motivation for this refactoring was that for the most part the *Set
classes were just lists of objects (with a few helper methods in some
cases). Thus, RingSet is a very slight specialization of List
(ArrayList or any other implementation).
While making RingSet implement List is a nice generalization, I don't
see how it helps us - I'd still have to implement the specific type of
List myself (?) In other words, I'd have to have a traditional
ArrayList based RingSet, a concurrent version of RingSet and so on.
See above. One could have single wrapper implementation and multiple builders.
In addition, a custom implementation of List interface may not have in-memory implementation at all, e.g. it could retrieve data from online resources on demand, databases, etc.
Perhaps I am going too far :)
So, why not just have multiple RingSet classes derived from the
specific variants of List implementations:
Less elegant (IMHO ) , more code duplicates and more dependent of actual implementation, thus not easily interchangeable.
The alaternative to all of this is to completely drop RingSet and just
move methods that work on collections of Rings into a manipulator class
Actually, my suggestion is for all classes, implementing set of chemical objects, not specific for the RingSet (but is only a suggestion).
A debugged program is one for which you have not yet found the
that make it fail.
-- Jerry Ogdin