Adapting code to multiple platforms

Jeremy Bowers jerf at jerf.org
Sat Mar 12 03:37:43 CET 2005


On Fri, 11 Mar 2005 17:27:06 -0700, Jeffrey Barish wrote:
> Most of my program lives in a class.  My plan is to have a superclass
> that performs the generic functions and subclasses to define methods
> specific to each platform....
> I'm just getting up to speed on Python and OOP, so I'm wondering whether I
> have missed something obvious.  I'm hoping that the strongest rebuke
> would be that I found something obvious.

You may be interested to know this is called the Template Pattern.

http://home.earthlink.net/~huston2/dp/templateMethod.html

Generally, while most of the patterns are obvious in hindsight they are
not necessarily obvious in advance, and I consider independently
re-discovering a pattern is a good sign; it's much easier to correct not
knowing about them than gaining the skills to independently re-derive them.



More information about the Python-list mailing list