File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 22# -*- coding: utf-8 -*-
33
44"""
5+ *What is this pattern about?
6+ This patterns aims to reduce the number of classes required by an
7+ application. Instead of relying on subclasses it creates objects by
8+ copying a prototypical instance at run-time.
9+
10+ This is useful as it make it easier to derive new kinds of objects,
11+ when instances of the class have only a few different combinations of
12+ state, and when instantiation is expensive.
13+
14+ *What does this example do?
15+ When the number of prototypes in an application can vary, it can be
16+ useful to keep a Dispatcher (aka, Registry or Manager). This allows
17+ clients to query the Dispatcher for a prototype before cloning a new
18+ instance.
19+
20+ Below provides an example of such Dispatcher, which contains three
21+ copies of the prototype: 'default', 'objecta' and 'objectb'.
22+
523*TL;DR80
624Creates new object instances by cloning prototype.
725"""
You can’t perform that action at this time.
0 commit comments