Popular recipes tagged "design"http://code.activestate.com/recipes/tags/design/2011-08-24T05:29:15-07:00ActiveState Code RecipesConcrete Class Finder (Python)
2011-08-24T05:29:15-07:00Lucio Santihttp://code.activestate.com/recipes/users/4178886/http://code.activestate.com/recipes/577858-concrete-class-finder/
<p style="color: grey">
Python
recipe 577858
by <a href="/recipes/users/4178886/">Lucio Santi</a>
(<a href="/recipes/tags/case/">case</a>, <a href="/recipes/tags/class/">class</a>, <a href="/recipes/tags/design/">design</a>, <a href="/recipes/tags/finder/">finder</a>, <a href="/recipes/tags/match/">match</a>, <a href="/recipes/tags/oop/">oop</a>, <a href="/recipes/tags/pattern/">pattern</a>, <a href="/recipes/tags/suitable/">suitable</a>, <a href="/recipes/tags/switch/">switch</a>).
</p>
<p>This recipe implements a design pattern useful for performing an object-oriented case analysis for a particular object (or a collection of objects as well). Essentially, it is an alternative to complex if-then-else or switches. Modelling each case with a particular class, the Concrete Class Finder searches for an appropriate case/class that applies to the given object/s. Once found, this class can be used in an homogeneous way, independently of the object/s previously considered.</p>
Maybe pattern (Python)
2010-07-21T11:08:11-07:00Alan Franzonihttp://code.activestate.com/recipes/users/4169882/http://code.activestate.com/recipes/577248-maybe-pattern/
<p style="color: grey">
Python
recipe 577248
by <a href="/recipes/users/4169882/">Alan Franzoni</a>
(<a href="/recipes/tags/design/">design</a>, <a href="/recipes/tags/maybe/">maybe</a>, <a href="/recipes/tags/pattern/">pattern</a>).
Revision 2.
</p>
<p>An example Maybe pattern implementation for Python.</p>
Maintenance free Factory design pattern (Python)
2009-03-12T08:54:39-07:00Akira Forahttp://code.activestate.com/recipes/users/4114779/http://code.activestate.com/recipes/576687-maintenance-free-factory-design-pattern/
<p style="color: grey">
Python
recipe 576687
by <a href="/recipes/users/4114779/">Akira Fora</a>
(<a href="/recipes/tags/design/">design</a>, <a href="/recipes/tags/factory/">factory</a>, <a href="/recipes/tags/free/">free</a>, <a href="/recipes/tags/maintenance/">maintenance</a>, <a href="/recipes/tags/pattern/">pattern</a>).
Revision 3.
</p>
<p>An implementation of the Factory design pattern that doesn't require maintenance when a new specialized subclass is added.</p>