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

Chris Fields cjfields at uiuc.edu
Tue Oct 3 14:29:51 UTC 2006


> 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




More information about the Bioperl-l mailing list