[Biococoa-dev] BCSequence class cluster

Alexander Griekspoor mek at mekentosj.com
Sat Jan 8 08:41:35 EST 2005


Op 8-jan-05 om 1:48 heeft John Timmer het volgende geschreven:

> Just a quick comment:
>
>> I just thought of an analogy to throw in the discussion. NSString has 
>> the path
>> methods like 'stringByAppendingPathExtension'. These will work on ANY 
>> string,
>> even if they are not path, but the contents of this email. However, 
>> it does
>> not make sense. Do we get a compiler warning? no. Do we get a runtime 
>> error?
>> no. Are we in trouble? yes. What the f... this string is doing here 
>> when I
>> should have a path??? This is clearly the fault of the user, here, 
>> not of the
>> guy who designed NSString. OK, this is really a much simpler 
>> situation than
>> ours, but still.
>
> Yeah, this analogy doesn't really work in terms of taking into account 
> why
> Alex and I worry.  You can add a .tiff to a non-path, and the result is
> still a string.  You might get unexpected behavior when you used it, 
> but
> you'd have to do something convoluted to get your app to crash as a 
> result.
>
> If you ask for a complement from a protein, you'll either get nil or
> something with a sequenceArray count of 0.  Either of these make it 
> very
> easy for a user to crash the app.  That's why I feel (and as of last 
> check,
> Alex did as well)
Yes sir!

> that things should be structured so that asking for the
> complement of a sequence object should generate a compiler warning if 
> it's
> not a nucleotide sequence (and likewise for other sequence type 
> specific
> methods).  It's the user-friendly thing to do.  If we're doing that, 
> then we
> should definitely have a header that informs users of what types of 
> sequence
> respond to what messages.
>
> I find it personally more satisfying to explicitly type my sequence
> variables so that the code is easier to follow and the right methods 
> pop up
> in code sense, but I recognize that that's probably a personal taste.

I like to type my variables as well like:
BCSequenceDNA* theDNA;
instead of a simple
BCSequence *theDNA;

Perhaps that should be the way a developer can choose to do weak or 
strong typing.
But I would not like to do a test before every method I call whether 
the method will respond properly to my sequence object. Or provide a 
protocol along with each method...
Alex

*********************************************************
                     ** 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

                             iRNAi, do you?
              http://www.mekentosj.com/irnai

*********************************************************




More information about the Biococoa-dev mailing list