[Biojava-l] Nasty CompoundLocation `issue'

Thomas Down td2@sanger.ac.uk
Thu, 31 May 2001 14:14:32 +0100


On Thu, May 31, 2001 at 09:19:10AM -0400, Cox, Greg wrote:
> My initial response is to have to constructor sort the list passed in.
> What's the payoff for making the constructor protected and accessing it
> through a static method?  

That's the other option.  Reasons I suggested the static method.

  - If we fixed the constructor, then code which already
    sorts the segments (e.g. LocationTools.union) loses the
    chance to skip the second sort.

  - Static method can recognize cases like lists of size 1.

  - Personal bias towards factory methods over explicit
    constructors, because it makes it easier to change
    implementations in the future.

None of these arguments are /terribly/ strong in this case --
I don't think the lists will ever get long enough that too
much time will be wasted sorting them (in any case, 
Collections.sort is pretty good at recognising already-sorted
lists, and returning quickly).  So it really doesn't matter
either way.

I would like to get it fixed quickly, though ;)

   Thomas.