[Biococoa-dev] BCNucleotideRNA

Koen van der Drift kvddrift at earthlink.net
Sun Sep 26 11:56:27 EDT 2004


On Sep 26, 2004, at 5:38 AM, Alexander Griekspoor wrote:

>

>> I had another look at BioJava to see how they solve this. Actually, 
>> they only have a Symbol class, no SymbolDNA, SymbolRNA, 
>> SymbolAminoAcid, etc. The same for Sequence, no subclassing. What 
>> they do is pass the right Alphabet (I think this is what Alex is 
>> working on in BCSymbolSet) to create a sequence, and you know you're 
>> dealing with DNA, RNA, Protein, etc.  It uses a couple of more 
>> classes (Alphabet, AlphabetManager, SequenceFactory, etc), but is a 
>> very elegant solution, IMO.
>
> Yes, it is. Still, that doesn't exclude that ours is not elegant as 
> well ;-) Seriously, we have discussed this way back and I pointed to 
> the way BioJava does things. Indeed the alphabet stuff is quite nice, 
> but overall I like the way we have done things just as much. In fact 
> the way we use class methods to generate shared instances, instead of 
> factory objects is something more elegant in my opinion.

I agree for the way we create the symbols. But for creating sequences, 
I still think it would be beneficial if we pass a string (or other 
BCSequence) plus the required BCSymbolSet either to BCSequence, or to 
an external class that will return a BCSequence. We don't have to 
replace the current code, this can be just an additional way to do 
things.

>>> Looking up methods in an ObjC superclass is significantly slower
>>> than having them in the object being used.
>>
>> I didn't know that. Is this only for ObjC, or also for other OO 
>> languages, such as C++ and Java?
>
> I was curious as well, and did some searching on the web on the 
> Objective-C runtime. I found this snippet:
>
> The method is looked up BY NAME, first in the class and then in each 
> superclass in order. Once a successful lookup has occurred (or failed 
> to occur) the associated function pointer (or pointer to the error 
> function) is cached so that future invocations are fast (~ 2-3x a 
> simple function call).
>
> So it seems you're right in principle, but given the fact that most 
> methods we're talking about are only one superclass up, and that after 
> the first time, the function pointer is cached, I can hardly imagine 
> that you will see anything of this.

The first lookup is during the init of the symbols, so any further 
manipulations should be fast, if I understand you correctly?

- Koen.




More information about the Biococoa-dev mailing list