[Biococoa-dev] Using an untyped class sequence

Koen van der Drift kvddrift at earthlink.net
Tue Jul 5 18:27:00 EDT 2005


On Jul 5, 2005, at 10:33 AM, John Timmer wrote:

>  In my earlier email, though, I provided a list of the advantages of 
> typed sequence classes and some disadvantages of the alternative. 
>  Koen had objected to typed sequence classes in the past because we 
> had some code duplications, but with that problem now fixed, I’m not 
> sure whether there are any disadvantages to typed classes.  I haven’t 
> seen an equivalent list of advantages to typed classes.  The only 
> thing that’s clear is that other BioX projects have used a single 
> sequence class, but we don’t currently know their reasoning.
>
>  So, can anyone sell me on the advantages of a single class?

I got a reply from the BioJava gut. He was not directly answering the 
question, but I will quote his reply here below:

<quote>
It's a question of encapsulation vs generality. I prefer the biojava
approach of having Sequence as general as possible and providing other
classes (like tools classes) to do the alphabet specific analysis.
Encapsulation has the advantage of having an RNA object know everything 
it
needs to know about itself built in.

However... Encapsulation means you would need one type for every type of
Alphabet someone might use. BioJava takes the nice approach of letting 
you
use any Alphabet (you can even make an Integer Sequence). Symbols are 
also
very generic in BioJava which is generally good because you can make a
Distribution over DNA or RNA or Protein with the same Distribution 
class.

In the early days I argued for encapsulation. I'm now very much in the
generic interface design school.

Two other tips that will make life easier...

Use interbase coordinates

Strand is best handled at the level of location not at the level of
feature.
</quote>


So I guess the separation of sequence and tools is a key argument. Of 
course you can also have this with subclasses :) Also the part about 
one subclass for each Alphabet (our symbolsets) is a valid one. We now 
have only a few, but soon will have mutable/immutable, 
strict/non-strict, etc. This will quickly increase the number of 
subclasses.

I have sent him some follow up questions, let's see what answer I get.

cheers,

- Koen.



More information about the Biococoa-dev mailing list