[Bioperl-l] Use of Root.pm versus RootI.pm

Stephen Gordon Lenk slenk at emich.edu
Tue Oct 3 16:45:15 UTC 2006


The separation of interface and implementation is generally
regarded as a good idea. Right now the Bioperl community is
doing this as part of the implementation of Bioperl. I suggest
that this is an example of something which you might want to
have as part of the Perl implementation. If Perl 6 (or even
Perl 5) does not have this as a core part of the language or
as a standard package (reusable by all in a common fashion),
you may want to suggest to the Perl implementers that a way
for interface/implementation distinctions be made part of the
core language. My 2 cents, as you people are the experts on 
your own code.


----- Original Message -----
From: Chris Fields <cjfields at uiuc.edu>
Date: Tuesday, October 3, 2006 10:29 am
Subject: Re: [Bioperl-l] Use of Root.pm versus RootI.pm

> > The interface classes (those ending in 'I') should actually inherit
> > from RootI, not Root.
> > 
> > In reality this recommendation is more theoretical than it makes 
> that> much of a difference I think. The motivation is that interface
> > classes should not determine the actual implementation of a class
> > (hash ref, array ref, whatever), and since Root.pm contains lots of
> > implementation using a hash ref that decision will basically have
> > been made.
> > 
> > On the contrary though, RootI contains implementation too, although
> > I'm not sure it would prescribe the object implementation as 
opposed
> > to merely implementing static methods (like throw(), warn(), etc).
> > That would need to be checked.
> > 
> > 	-hilmar
> 
> The constructor in Bio::Root::RootI lets one know that its use is
> deprecated, so you shouldn't have any cases of 'our 
> qw(Bio::Root::RootI)';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.  
> For the
> current implementation we should only inherit Bio::Root::Root, which
> implements RootI.
> 
> Is there any reason to shut off the warning with BIOPERLDEBUG?  
> 
> >From RootI:
> 
> sub new {
>  my $class = shift;
>  my @args = @_;
>  unless ( $ENV{'BIOPERLDEBUG'} ) {
>      carp("Use of new in Bio::Root::RootI is deprecated.  Please use
> Bio::Root::Root instead");
>  }
>  eval "require Bio::Root::Root";
>  return Bio::Root::Root->new(@args);
> }
> 
> 
> Christopher Fields
> Postdoctoral Researcher - Switzer Lab
> Dept. of Biochemistry
> University of Illinois Urbana-Champaign
> 
> 
> 
> > 
> > On Oct 3, 2006, at 12:30 AM, Torsten Seemann wrote:
> > 
> > > My understanding is that all Bioperl-compliant classes should 
> inherit> > from Bio::Root::Root, not Bio::Root::RootI.
> > >
> > > Additionally, if functions such as throw() or _rearrange() are 
> to be
> > > used without a class instance reference, they are to be used 
> as class
> > > methods via Bio::Root::Root, not Bio::Root::RootI.
> > >
> > > Is this correct?
> > >
> > > My naive audit of bioperl-live CVS brought up the following
> > > statistics:
> > >
> > > # Root.pm
> > > /cvs/bioperl-live $ grep -r 'use Bio::Root::Root;' Bio | wc -l
> > > 26
> > > /cvs/bioperl-live $ grep -r 'use base.*Bio::Root::Root' Bio | 
> wc -l
> > > 346
> > >
> > > # RootI.pm
> > > /cvs/bioperl-live $ grep -r 'use Bio::Root::RootI;' Bio | wc -l
> > > 9
> > > /cvs/bioperl-live $ grep -r 'use base.*Bio::Root::RootI' Bio | 
> wc -l
> > > 79
> > >
> > > My guess would be that all RootI should be changed to plain 
> Root ?
> > >
> > > Any help appreciated,
> > >
> > > --
> > > Dr Torsten Seemann               http://www.vicbioinformatics.com
> > > Victorian Bioinformatics Consortium, Monash University, Australia
> > >
> > > _______________________________________________
> > > Bioperl-l mailing list
> > > Bioperl-l at lists.open-bio.org
> > > http://lists.open-bio.org/mailman/listinfo/bioperl-l
> > >
> > 
> > --
> > ===========================================================
> > : Hilmar Lapp  -:-  Durham, NC  -:-  hlapp at gmx dot net :
> > ===========================================================
> > 
> > 
> > 
> > 
> > 
> > _______________________________________________
> > Bioperl-l mailing list
> > Bioperl-l at lists.open-bio.org
> > http://lists.open-bio.org/mailman/listinfo/bioperl-l
> 
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l
> 



More information about the Bioperl-l mailing list