[Biococoa-dev] the decorator pattern

Koen van der Drift kvddrift at earthlink.net
Fri Sep 10 21:19:29 EDT 2004


One of the many software design patterns is the decorator pattern. 
Basically the idea is to add additional functionality to an object 
without subclassing. Usually the decoration takes place during runtime, 
and therefore is dynamic, in contrast to subclassing which is static. 
Real examples are adding a border to a shape in a drawing program, or a 
style to a text (bold, italics).

So maybe we should think about using the decorator pattern in BioCocoa 
to add temporarily additional functionality to existing classes. For 
instance a modification, annotation, or digest info.  After the 
discussion with Alex about the subclasses after a digest, I still had a 
feeling that all those subclasses aren't really necessary.

Anyway, I will have to read more about this, to see how it exactly is 
implemented (most sample code and tutorials I found is in Java and very 
short), and if it is really useful for BioCocoa. I will post later if I 
know more.

Why do you guys think?


- Koen.

More information about the Biococoa-dev mailing list