[Bioperl-l] Bio::SeqFeature::FeaturePair, HMMER

Hilmar Lapp hlapp@gmx.net
Thu, 14 Sep 2000 13:06:41 +0200


As those subscribed to the guts list will have noticed, I changed the
inheritance of Bio::SeqFeature::FeaturePair and
Bio::Tools::HMMER::Domain.

The first one now inherits directly off Bio::SeqFeature::Generic instead
of re-implementing SeqFeatureI in an incomplete way. The second now
inherits directly off FeaturePair (because of the first change, it
doesn't have to inherit off SeqFeature::Generic any longer).

Changed on both the main trunk and the branch. Tests run ok.

There are several issues:
1) When inheriting off an interface and a class implementing that
interface, because of the poor support of Perl for OO-concepts calling an
interface method results in an _abstract_death (or whatever the interface
implementation does), because you can't really have abstract methods in
Perl (the Perl compiler finds 'inherited' methods by first encounter: if
that one actually is meant abstract by you, Perl won't know). Changing
the order of inheritance solves this problem, but then why inherit off
the interface at all?
2) Implementing methods an interface requires with zero functionality is
a bad idea: a caller or test-script won't notice immediately that he
called something that is not supported by the module, but instead may
experience subtle failures later on. So, if your module doesn't support a
particular method the interface you're implementing requires, either
don't supply them at all (usually the interface will catch calls by
throwing an exception), or provide an implementation that throws an
exception with an appropriate message. DO NOT implement that methods by
just returning undef, zero, etc.

	Hilmar

-- 
-----------------------------------------------------------------
Hilmar Lapp                                email: hlapp@gmx.net
NFI Vienna, IFD/Bioinformatics             phone: +43 1 86634 631
A-1235 Vienna                                fax: +43 1 86634 727
-----------------------------------------------------------------