Bioperl: Accessing sequences via Bio::DB::SeqI

Matthew Pocock mrp@sanger.ac.uk
Fri, 05 May 2000 11:43:39 +0100


James Gilbert wrote:

> On Mon, 1 May 2000, Ewan Birney wrote:
>
> > On Mon, 1 May 2000, Mark Dalphin wrote:
> >
> > > Thanks for the reply, Ewan.  I have a further naive quetion about the use of the
> > > modules:
> > >
> > > Following on from my earlier letter, I see now that Bio::DB::GenBank.pm ISA
> > > RandomAccessI.pm and that SeqI.pm ISA a RandomAccessI.pm. And I understand your
> > > design in making SeqI.pm a superset of RandomAccessI.pm.
> > >
> > > Where I am stuck is in "Why is RandomAccessI.pm ISA RootI.pm?"  One needs to
> > > eventiually inherit from a concrete class, I would think.  In that case, I would
> > > think that RandomAccessI.pm ISA Bio::Root::Object.pm would make more sense.  Then one
> > > could write:
> >
> > This is complex, so I appreciate your confusion. The RootI inheritance is
> > correct. The interfaces should not mandate a particular implementation.
> > The thing to keep in mind is that one might have a _radically_ different
> > implementation behind an interface. The best example I know are C structs
> > bound in via XS, providing hyper-fast bioperl "objects" without being
> > implemented at all in Perl. It is very cute. (and works ...)
>
> I think the BioPerl "I" modules confuse people who
> are used to working with interfaces, because they
> contain a lot of "decorator" methods, which
> actually do things, and so are not pure abstract
> interfaces.  Bio::Root::RootI implements all of
> its methods, so I think it _is_ the concrete class
> that Mark is looking for.
>
>         James
>

I find having code in the "xxxI" files nasty. Interfaces should realy just define the
contract for the object, and not contain any implementation details (read code). If there are
some standard partial implementations, then it can go into AbstractXxx, and people can
inherit off that, filling in the missing abstract methods. But of course, that adds more
packages (and I am probably biassed by programming too much Java).

Matthew

>
> James G.R. Gilbert
> The Sanger Centre
> Wellcome Trust Genome Campus
> Hinxton
> Cambridge                        Tel: 01223 494906
> CB10 1SA                         Fax: 01223 494919
>
> =========== Bioperl Project Mailing List Message Footer =======
> Project URL: http://bio.perl.org/
> For info about how to (un)subscribe, where messages are archived, etc:
> http://www.techfak.uni-bielefeld.de/bcd/Perl/Bio/vsns-bcd-perl.html
> ====================================================================

--
Joon: You're out of your tree
Sam:  It wasn't my tree
                                                 (Benny & Joon)


=========== Bioperl Project Mailing List Message Footer =======
Project URL: http://bio.perl.org/
For info about how to (un)subscribe, where messages are archived, etc:
http://www.techfak.uni-bielefeld.de/bcd/Perl/Bio/vsns-bcd-perl.html
====================================================================