Bioperl: Start of alignment debate...

Andrew Dalke
Fri, 15 Jan 1999 13:14:17 -0800

Gordon D. Pusch <> said:
> If one wants an ``immutable'' alignment class, it makes more sense to me
> to make it a derived class of the general (``mutable'') alignment class,
> rather than the other way round...

  Speaking from a pure OO viewpoint, the set of possible inputs for
a derived classes should be a superset of the possible inputs for the
superclass.  Similarly, the possible outputs should be a subset of
the possible outputs for the superclass.

  This is because in a well designed system, a derived class should
be able to be used anywhere the superclass is used.  (If you read
the Eiffel book you'll have this rammed into your brain :)

  Your proposal implies that the derived class, which is immutable,
cannot always be used in the same place as the superclass.  Another
mechanism, which would allow both operations, is to use a mix-in.
ImmutableAlignment contains a MutableAlignment but only forwards
the non-edit methods calls.

  Another possibility is for Immutable and Mutable to be derived
from BaseAlignment.  Have the last implement all the methods which
don't depend on the data being mutable or immutable.  Immutable
would offer those methods which require knowing that the alignment
cannot be changed while Mutable offers methods that change the

  This second option feels better.

						Andrew Dalke
=========== Bioperl Project Mailing List Message Footer =======
Project URL:
For info about how to (un)subscribe, where messages are archived, etc: