Skip to content

Commit 2c29478

Browse files
committed
Merge branch 'FalloutX-master'
2 parents 027e6e7 + 111dfa3 commit 2c29478

File tree

2 files changed

+39
-18
lines changed

2 files changed

+39
-18
lines changed

README.md

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,37 +9,55 @@ comments at the bottom up to date.
99

1010
Current Patterns:
1111

12+
__Creational Patterns__:
13+
1214
| Pattern | Description |
1315
|:-------:| ----------- |
14-
| [3-tier](3-tier.py) | data<->business logic<->presentation separation (strict relationships) |
1516
| [abstract_factory](abstract_factory.py) | use a generic function with specific factories |
16-
| [adapter](adapter.py) | adapt one interface to another using a whitelist |
1717
| [borg](borg.py) | a singleton with shared-state among instances |
18+
| [builder](builder.py) | instead of using multiple constructors, builder object receives parameters and returns constructed objects |
19+
| [factory_method](factory_method.py) | delegate a specialized function/method to create instances |
20+
| [lazy_evaluation](lazy_evaluation.py) | lazily-evaluated property pattern in Python |
21+
| [pool](pool.py) | preinstantiate and maintain a group of instances of the same type |
22+
| [prototype](prototype.py) | use a factory and clones of a prototype for new instances (if instantiation is expensive) |
23+
24+
__Structural Patterns__:
25+
26+
| Pattern | Description |
27+
|:-------:| ----------- |
28+
| [3-tier](3-tier.py) | data<->business logic<->presentation separation (strict relationships) |
29+
| [adapter](adapter.py) | adapt one interface to another using a white-list |
1830
| [bridge](bridge.py) | a client-provider middleman to soften interface changes |
19-
| [builder](builder.py) | call many little discrete methods rather than having a huge number of constructor parameters |
20-
| [catalog](catalog.py) | general methods will call different specialized methods based on construction parameter |
21-
| [chain](chain.py) | apply a chain of successive handlers to try and process the data |
22-
| [chaining_method](chaining_method.py) | continue callback next object method |
23-
| [command](command.py) | bundle a command and arguments to call later |
2431
| [composite](composite.py) | encapsulate and provide access to a number of different objects |
2532
| [decorator](decorator.py) | wrap functionality with other functionality in order to affect outputs |
2633
| [facade](facade.py) | use one class as an API to a number of others |
27-
| [factory_method](factory_method.py) | delegate a specialized function/method to create instances |
28-
| [front_controller](front_controller.py) | single handler requests coming to the application |
2934
| [flyweight](flyweight.py) | transparently reuse existing instances of objects with similar/identical state |
30-
| [graph_search](graph_search.py) | (graphing algorithms, not design patterns) |
31-
| [lazy_evaluation](lazy_evaluation.py) | lazily-evaluated property pattern in Python |
35+
| [front_controller](front_controller.py) | single handler requests coming to the application |
36+
| [mvc](mvc.py) | model<->view<->controller (non-strict relationships) |
37+
| [proxy](proxy.py) | an object funnels operations to something else |
38+
39+
__Behavioral Patterns__:
40+
41+
| Pattern | Description |
42+
|:-------:| ----------- |
43+
| [chain](chain.py) | apply a chain of successive handlers to try and process the data |
44+
| [catalog](catalog.py) | general methods will call different specialized methods based on construction parameter |
45+
| [chaining_method](chaining_method.py) | continue callback next object method |
46+
| [command](command.py) | bundle a command and arguments to call later |
3247
| [mediator](mediator.py) | an object that knows how to connect other objects and act as a proxy |
3348
| [memento](memento.py) | generate an opaque token that can be used to go back to a previous state |
34-
| [mvc](mvc.py) | model<->view<->controller (non-strict relationships) |
3549
| [observer](observer.py) | provide a callback for notification of events/changes to data |
36-
| [pool](pool.py) | preinstantiate and maintain a group of instances of the same type |
37-
| [prototype](prototype.py) | use a factory and clones of a prototype for new instances (if instantiation is expensive) |
38-
| [proxy](proxy.py) | an object funnels operations to something else |
3950
| [publish_subscribe](publish_subscribe.py) | a source syndicates events/data to 0+ registered listeners |
4051
| [registry](registry.py) | keeping track of all subclasses of a given class |
4152
| [specification](specification.py) | business rules can be recombined by chaining the business rules together using boolean logic |
42-
| [state](state.py) | logic is org'd into a discrete number of potential states and the next state that can be transitioned to |
53+
| [state](state.py) | logic is organized into a discrete number of potential states and the next state that can be transitioned to |
4354
| [strategy](strategy.py) | selectable operations over the same data |
4455
| [template](template.py) | an object imposes a structure but takes pluggable components |
4556
| [visitor](visitor.py) | invoke a callback for all items of a collection |
57+
58+
59+
__Others__:
60+
61+
| Pattern | Description |
62+
|:-------:| ----------- |
63+
| [graph_search](graph_search.py) | (graphing algorithms, not design patterns) |

registry.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ def get_registry(cls):
2020
return dict(cls.REGISTRY)
2121

2222

23-
class BaseRegisteredClass(metaclass=RegistryHolder):
23+
class BaseRegisteredClass:
24+
__metaclass__ = RegistryHolder
2425
"""
2526
Any class that will inherits from BaseRegisteredClass will be included
2627
inside the dict RegistryHolder.REGISTRY, the key being the name of the
@@ -37,11 +38,13 @@ class ClassRegistree(BaseRegisteredClass):
3738

3839
def __init__(self, *args, **kwargs):
3940
pass
41+
42+
4043
print("After subclassing: ")
4144
for k in RegistryHolder.REGISTRY:
4245
print(k)
4346

44-
### OUTPUT ###
47+
### OUTPUT ###
4548
# Before subclassing:
4649
# BaseRegisteredClass
4750
# After subclassing:

0 commit comments

Comments
 (0)