Subject: [Biococoa-dev] New Structure for BioCocoa part II
Koen van der Drift
kvddrift at earthlink.net
Mon Jul 4 14:11:40 EDT 2005
On Jul 4, 2005, at 1:26 PM, John Timmer wrote:
> Wow, just got back from a couple of days relaxing away from the city,
> and I see things have been very busy. Anyway, as I never planned on
> taking advantage of the class cluster features
I think that is actually one of the problems with the design. The way
that I thought it should be used is that we only should use BCSequence,
and the internal code would figure out what kind of sequence we are
dealing with. However you seem to be using the subclasses directly. I
am not saying that one approach is better than the other, but if it is
even confusing or unclear for the BioCocoa developers, I can imagine
how confusing it could be for users of the framework!
> So, Koen, could you state what your current thoughts are regarding
> what’s wrong with the current subclass structure, and what advantages
> a single class would bring.
For the record, I didn't initiate the current discussion about the
design of the BCSequence classes. I think it was a conspiracy from the
guys who went to wwdc :)
Anyway, my main gripe with the subclasses was that when we first
started implementing the code, we were duplicating a lot of code over
all subclasses. When using OOP, in such cases it is very beneficial to
move all the similar code to a common superclass. And in fact most of
the code was similar and it turned out that only in a few cases this is
not possible, exactly for the cases that you describe. However, by
using symbolsets (aka alphabets) I think we can have some internal
typing that can avoid these problems. As I said before this is also the
approach of our siblings bioperl, biopython and biojava. For instance,
biojava uses sequence specific classes that are used to perform
operations, eg (in javacode):
Sequence dna = DNATools.createDNASequence("atgctg", "dna_1");
or:
IsoelectricPointCalc ic = new IsoelectricPointCalc();
pI = ic.getPI(protein, true, true);
The code throws a exception when the wrong type of sequence is used.
Indeed not an ideal situation, since as you stated correctly, it might
crash the program. And to be honest, I have currently no solution to
prevent that.
cheers,
- Koen.
More information about the Biococoa-dev
mailing list