[Biococoa-dev] [BioCocoa] Speed vs Safety

Alexander Griekspoor a.griekspoor at nki.nl
Mon Aug 30 01:44:52 EDT 2004

> You're right that I'm probably projecting the amazing and unexpected 
> things
> that users do to developers, hence the paranoia.
Believe me I've seen amazing things indeed ;-)
> A couple of things to be said in my favor -
John, just to make clear, my email was absolutely not personal and I 
was certainly not accusing you of anything here, what I hope to do 
initialize here is to let us shift our thoughts from one centered on 
users to one centered on developers as our target audience.

> I've tried to limit most of the
> paranoia to situations involving either object creation or file input.
> There's a couple of reasons for this.  One is that, in comparison to 
> memory
> allocation or disk input and output, error checking's going to be time
> inexpensive (all the tests for the tempDictionary didn't add any time 
> that
> was distinguishable from background noise to the DNA manipulations in 
> the
> demo_app). to be relatively difficult to introduce them later (though 
> clearly, as you
> note, not impossible).
That's true for the nucleotides which are instantiated once, but the 
initWithSequence method is used very often as integral part of 
manipulations as well, like the example Koen gave in, where it really 
matters speed-wise. In addition, I can imagine that certainly during 
manipulations you use these methods while being absolutely sure already 
that the sequence is 100% correct, and still it would be checked again.

> So how about we make a deal - I won't complain if you remove my error
> checking code from anything that doesn't involve initializing or 
> disk-I/O,
> and you don't complain about me putting them in those places?
Well, I would like to setup the deal differently. The checking is fine 
by me in our singleton classes which are instantiated only once. In the 
other init classes like initWithSequence and classes where we are 
handed stuff we don't know the contents of for sure, we don't do the 
error checking but we do offer the developer validation methods as Koen 
proposed (like BOOL validateSequence:) so that the developer can opt to 
for speed or safety. Deal? ;-)

> Incidentally, the tempDict variable was used back when I did my 
> nucleotides
> with an "initWithDictionary:" method, and it didn't seem worth 
> removing the
> error test after I changed it to an "initWithSymbol".
Well, if it adds code and doesn't make things clearer, let's remove it 
or not? I love making deals ;-)


                     ** Alexander Griekspoor **
               The Netherlands Cancer Institute
               Department of Tumorbiology (H4)
          Plesmanlaan 121, 1066 CX, Amsterdam
                     Tel:  + 31 20 - 512 2023
                     Fax:  + 31 20 - 512 2029
                     AIM: mekentosj at mac.com
                     E-mail: a.griekspoor at nki.nl
                 Web: http://www.mekentosj.com

Windows is a 32-bit patch to a 16-bit shell for an 8-bit
operating system, written for a 4-bit processor by a 2-
bit company without 1 bit of sense.


More information about the Biococoa-dev mailing list