[Bioperl-l] Use of Root.pm versus RootI.pm
cjfields at uiuc.edu
Wed Oct 4 11:35:16 EDT 2006
> Don't confuse the constructor with the inheritance tree.
> Interface classes should never be instantiated, hence the
> constructor, consistent with the documentation, should never get
I know that interfaces shouldn't be instantiated. I had noticed there are
cases of 'our qw (Bio::Root::RootI)' where it is completely acceptable to
inherit the interface. Makes sense to me now.
> > there should be some way of inheriting Root directly or
> > indirectly. I would
> > say that any direct use of RootI is not good practice, though.
> I don't know what you mean by 'directly' or 'indirectly' but
> inheritance from interfaces, and interfaces extending (inheriting
> from) other interfaces, is certainly standard practice. I'm not sure
> at all why it would be a bad one.
I was talking specifically about inheriting RootI, and not about all Bioperl
interfaces in general. I completely understand the use of
interface/implementation in Bioperl. However, I missed one small fact until
yesterday (of course AFTER I posed my reply), which was that interfaces may
inherit RootI directly. My oops.
I had understood that, in general, any Bioperl implementation should not
inherit the RootI interface directly (they should inherit Root, since that
implements RootI). The 'constructor' present in RootI is essentially to
make sure that no one inherits from the wrong class.
Probably a bad use of the terms 'direct' and 'indirect', so maybe I didn't
get that across very well. What I meant was that all classes inherit Root
in some way, either 'directly' (as the direct parent class) or 'indirectly'
(through the inheritance tree). Probably comes from being primarily a
molecular microbiologist and not a computer scientist.
OT, but it would be nice to have an updated class diagram to sort out the
inheritance hierarchy a bit easier. In the meantime, the Deobfuscator does
help quite a bit.
> > For the current implementation we should only inherit
> > Bio::Root::Root, which
> > implements RootI.
> For the implementation classes, yes. For the interface classes, no.
I agree (see above). That's the one small bit about interfaces I missed
along the way. Makes sense; they use throw_not_implemented(), which is a
More information about the Bioperl-l