[Biococoa-dev] the decorator pattern

Koen van der Drift kvddrift at earthlink.net
Sat Sep 11 09:39:21 EDT 2004

On Sep 11, 2004, at 3:14 AM, Alexander Griekspoor wrote:

> The idea was to store not only the sequence, but also the enzymes that 
> produced both ends and for example the original position in the uncut 
> sequence. The solution we came up with was to have a BCFragment class 
> that is a subclass of BCSequence which adds the needed variables to 
> store the enzymes and position. And it would quickly mean three other 
> classes, BCFragmentDNA/RNA/Protein. The 'decorator' pattern might 
> indeed help, as we could make BCFragment normally descend of NSObject 
> and act as a simple wrapper that stores a BCSequence (any type), the 
> BCEnzymes which produce each end, and the position in the uncut 
> sequence. The BCDigest class simply spits out BCFragments in this 
> case.

That's exactly what I had in mind. Are you going to work on this, 
otherwise I can try something this weekend, if I can find some time.

> I'm not sure if the features/annotations would benefit from this 
> approach, it somehow feels the wrong way around for those. There the 
> BCSequence acts as a wrapper for a number of sequences, and these are 
> also intrinsic parts of all BCSequence objects, guess therefore these 
> belong just in the class itself. But if you can show otherwise, I'm 
> looking forward to that....

I don't know yet - but maybe we can use it for modifications? I will 
need to think about this a little bit more.

> Ps. perhaps I should really start reading the book to further mine new 
> insights ;-)

Maybe I should get my own copy as well, I only had it checked out from 
the library a long time ago.

- Koen.

More information about the Biococoa-dev mailing list