Design pattern question

Ben S newsgroups2002 at thedarkness.fsnet.co.uk
Wed Aug 21 14:57:22 EDT 2002


Karl Schmid wrote:
> Hi,
>
> I would like to separate an abstraction from its implementation. I
> think this is called the Bridge pattern by Gamma et al. (or at least
> it is a part of a bridge pattern).
>
> In particular, I would like to assemble a set of DNA sequences and
> have the option to chose among different assembly algorithms. I am
> not sure what the best way to do this would be:

Just to redirect your search a little bit - the behaviour you ask for is
actually more like the Strategy pattern rather than the Bridge pattern.
I don't know much about Python, having only started using it recently,
but you could probably implement it in much the same way that you would
in C++ or Java - simply pass a class as a parameter where that class
supports all the methods that the algorithm requires. That doesn't have
to be at initialisation - it could be at any point.

--
Ben Sizer
http://pages.eidosnet.co.uk/kylotan





More information about the Python-list mailing list