Re; [Bioperl-l] Changes to Bio::SeqI broke Bio::Graphics

Nathan (Nat) Goodman natg@shore.net
Sat, 9 Nov 2002 09:43:09 -0800


> >
> > Why? So that they looked like sequence features? I still think it is
wrong
> > to have Bio::SeqI inherieting from Bio::RangeI.
>
> When rendering the features of a sequence, it looks nice to have a single
> feature that goes all the way across the whole sequence labeled with the
> display_id of the sequence.  When Bio::SeqI had start() and end()
features,
> this was sufficient to pass the sequence object to the drawing code and
get
> the desired effect.
>

I'd like to weigh in on the side of having Bio::SeqI inherit from
Bio::RangeI.

I think it’s useful for classes  that are conceptually similar to support
similar protocols (i.e., to implement similar sets of methods).  This idea
dates from the old Smalltalk days where the notion of “protocol” is separate
from inheritance, and where it’s common for classes to combine protocols of
many different kinds.  The same idea underlies the use of mix-ins in Common
Lisp.  It's too bad that in Perl we have to use a single design mechanism --
@ISA -- to support these diverse design paradigms, but such is life.

A sequence is range-like – it spans an extent – and thus should implement
the range protocol.  I’m not claiming that a sequence is-a range – it most
certainly is not – but rather that it is sufficiently like a range that
programmers would naturally expect it to support the range protocol.

Best,
Nat