[Biococoa-dev] Re: a new design to please everybody (am I pleased?)
jtimmer at bellatlantic.net
Sun Jan 9 09:49:22 EST 2005
> I have one question though: if I get it right, the only reason we need
> the strongly typed approach as an extra option to the good-for-all
> BCSequence object is that people will get compiler warnings? Or are
> there additional reasons? To paraphrase Koen, this is an educational
> question, not a critical one ;-)
As probably the strongest advocate for it, let me give a few reasons:
The compiler warnings are definitely one thing - in practice, they're the
biggest way I identify when I've been sloppy with my coding before resorting
Non-typed methods mean that the sequence type has to be checked every time
the method is called, slowing the code down.
Uncertain return values mean that careful developers will have to surround
every method call with tests (did it return nil? Was the returned sequence
length 0?) that slow the code down and are very tedious to constantly
How are we going to define a sensible return value for a method call that
makes no sense in the first place? Is nil appropriate? Throwing an
With typed classes, methods could actually be grouped with the data they
could operate on, instead of in with data they may or may not operate on.
At 4 non-abstract classes to represent all sequences, I hadn't thought the
structure was that bad.
What is the advantage of allowing something that makes no biological sense
(ie - complementing a protein)?
I'm sure I could think of more were I not a bit foggy headed from cold
medication. It just feels like we're twisting the biology in order to
achieve code elegance.
And I'm not even certain we're achieving that - it feels like the equivalent
of getting rid of all of the UI control classes in order to achieve the code
purity of only interacting with NSViews. A button responds to different
things and conveys different information than a slider does - they're
different classes. The same could be said for a protein and a DNA sequence
- why treat them like they're the same class?
Although the class cluster idea is very appealing on an intellectual level,
it's going to take some extra work to implement it in such a way that users
(again, meaning non-contributing developers) will be able to grasp it
easily. And the internal structure is probably going to be extremely
confusing to anyone downloading the source for the first time. Given that,
I'm just wondering whether it's going to be more effort than it's worth. As
someone noted a few mails ago, it's going to require extensive
documentation, and the assumption that developers are any better about
reading the documentation than regular users are.
As an aside, I was struck by the following quote from Charles:
> 2. Oups, BCSequenceProtein.h does also import BCSequence.h, so the compiler
> thinks that BCSequenceProtein can respond to '-complement'. Well, and all the
> methods. So much for a strongly-typed sequence class!! What do I do??
> OK, I remove -complement from the BCSequence.h header, and only put it in
> BCSequenceDNA.h, but not in BCSequenceProtein.h
> 3. Aïe, now BCSequence gets some compiler warnings when trying to use
> -complement. How do I prevent that??
Item 3 is the whole point - it's a good thing, not something that needs to
be prevented ;).
This mind intentionally left blank
More information about the Biococoa-dev