[Bioperl-l] SeqIO parsing
Allen Smith
easmith@beatrice.rutgers.edu
Tue, 24 Sep 2002 18:20:01 -0400
On Sep 24, 2:49pm, Hilmar Lapp wrote:
> On Tuesday, September 24, 2002, at 09:01 AM, Ewan Birney wrote:
> >
> > this scheme in my mind has one *SERIOUS* gotcha. People *have* to write
> > their @ISA's with their implementation tree *first* and their interface
> > inheritance second. Is this ok with people?
> >
>
> It should be the style everyone employs already. Otherwise you set
> yourself up for trouble anyway (how would you avoid the interface
> method stub that throws an exception from being invoked if you put
> the interface first?).
I'm wanting to make sure that I (and hopefully others!) understand what
you're meaning here. So, in creating a module, the layout should be
something like:
In Bio::Matrix::Substitution:
use Bio::Root::Root;
use Bio::Root::IO;
use Bio::Matrix::SubstitutionI;
[...]
@ISA = qw(Bio::Root::Root Bio::Root::IO Bio::Matrix::SubstitutionI);
In Bio::Matrix::SubstitutionI:
use Bio::Root::RootI;
[...]
@ISA = qw(Bio::Root::RootI);
[bunch of functions, _not_ including 'new' (or the similar 'newIO'),
which all look something like:
sub string {
my $self = shift;
$self->throw_not_implemented();
}
I do have the problem with this that it appears to lessen the
utility of $object->can('something'), as I understand it - it would
be only for optional functions, then?]
This at least seems to work in my preliminary testing, but I'm afraid that I
find the whole implementation/interface distinction - actually, object
orientation in general - difficult to get, so I'm nervous about this...
Thanks,
-Allen
--
Allen Smith http://cesario.rutgers.edu/easmith/
September 11, 2001 A Day That Shall Live In Infamy II
"They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety." - Benjamin Franklin