[Open-bio-l] Re: [Bioperl-l] seq namespace method

Hilmar Lapp hlapp@gnf.org
Thu, 18 Jul 2002 10:03:55 -0700


Keep in mind that $obj->identifier() returns an object. There may be situations in which an identifier hasn't been set yet for an object that is supposed to be identifiable. Or choose the wording 'that can be identifiable' (I'd rather not have separate classes for the not-identifiable and the identifiable variants).

What I'd hate to do is to check the return value for undef every time before you call a method on it. I actually like the Biojava idea for this kind of situation to return a default 'dummy' object that is not undef, but is a static singleton and returns e.g. empty strings (probably also better than returning undef).

	-hilmar

> -----Original Message-----
> From: Matthew Pocock [mailto:matthew_pocock@yahoo.co.uk]
> Sent: Thursday, July 18, 2002 3:21 AM
> To: lstein@cshl.org
> Cc: Ewan Birney; sac@bioperl.org; Hilmar Lapp; OBDA BioSQL (E-mail);
> BioPerl (E-mail)
> Subject: Re: [Open-bio-l] Re: [Bioperl-l] seq namespace method
> 
> 
> (oops - hit r not R)
> 
> > Lincoln Stein wrote:
> > I liked the compromise you published earlier yesterday:
> > 
> >     - Bio::PrimarySeqI inherits/implements IdentifiableI.
> >         This is its "one true" name.
> >     - The cloud of other identifiers is attached to Bio::Seq via
> >     its AnnotationCollectionI.
> > 
> > I will work on IdentifierCollectionI as a separate interface.
> > 
> > Lincoln
> 
> All sounds sensible. One small thing. Do you want to make all 
> Bio::PrimarySeqI objects implement IdentifiableI, or should it be 
> implementation-specific? Not every implementation (or even every 
> instance of a given implementation) will have data that can 
> be used to 
> construct a meaningfull identifier. To avoid generating 'made up' 
> identifiers or passing undefs arround, I would be happier to 
> see code like:
> 
> if($seq->ISA("IdentifiableI")) {
>    $id = $seq->identifier();
> }
> 
> This could be the general pattern for any entity that could be 
> identifiable e.g.
> 
> $seq->ISA("IdentifiableI")
> $phylogeny->ISA("IdentifiableI");
> $expression->ISA("IdentifiableI");
> $cluster->ISA("IdentifiableI");
> $alignment->ISA("IdentifiableI");
> $feature->ISA("IdentifiableI");
> $applicationRunner->ISA("IdentifiableI");
> 
> Matthew
> 
>