You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+41-41Lines changed: 41 additions & 41 deletions
Original file line number
Diff line number
Diff line change
@@ -10,68 +10,68 @@ __Creational Patterns__:
10
10
11
11
| Pattern | Description |
12
12
|:-------:| ----------- |
13
-
|[abstract_factory](creational/abstract_factory.py)| use a generic function with specific factories |
14
-
|[borg](creational/borg.py)| a singleton with shared-state among instances |
15
-
|[builder](creational/builder.py)| instead of using multiple constructors, builder object receives parameters and returns constructed objects |
16
-
|[factory_method](creational/factory_method.py)| delegate a specialized function/method to create instances |
17
-
|[lazy_evaluation](creational/lazy_evaluation.py)| lazily-evaluated property pattern in Python |
18
-
|[pool](creational/pool.py)| preinstantiate and maintain a group of instances of the same type |
19
-
|[prototype](creational/prototype.py)| use a factory and clones of a prototype for new instances (if instantiation is expensive) |
13
+
|[abstract_factory](patterns/creational/abstract_factory.py)| use a generic function with specific factories |
14
+
|[borg](patterns/creational/borg.py)| a singleton with shared-state among instances |
15
+
|[builder](patterns/creational/builder.py)| instead of using multiple constructors, builder object receives parameters and returns constructed objects |
16
+
|[factory_method](patterns/creational/factory_method.py)| delegate a specialized function/method to create instances |
17
+
|[lazy_evaluation](patterns/creational/lazy_evaluation.py)| lazily-evaluated property pattern in Python |
18
+
|[pool](patterns/creational/pool.py)| preinstantiate and maintain a group of instances of the same type |
19
+
|[prototype](patterns/creational/prototype.py)| use a factory and clones of a prototype for new instances (if instantiation is expensive) |
|[proxy](patterns/structural/proxy.py)| an object funnels operations to something else |
35
35
36
36
__Behavioral Patterns__:
37
37
38
38
| Pattern | Description |
39
39
|:-------:| ----------- |
40
-
|[chain](behavioral/chain.py)| apply a chain of successive handlers to try and process the data |
41
-
|[catalog](behavioral/catalog.py)| general methods will call different specialized methods based on construction parameter |
42
-
|[chaining_method](behavioral/chaining_method.py)| continue callback next object method |
43
-
|[command](behavioral/command.py)| bundle a command and arguments to call later |
44
-
|[iterator](behavioral/iterator.py)| traverse a container and access the container's elements |
45
-
|[mediator](behavioral/mediator.py)| an object that knows how to connect other objects and act as a proxy |
46
-
|[memento](behavioral/memento.py)| generate an opaque token that can be used to go back to a previous state |
47
-
|[observer](behavioral/observer.py)| provide a callback for notification of events/changes to data |
48
-
|[publish_subscribe](behavioral/publish_subscribe.py)| a source syndicates events/data to 0+ registered listeners |
49
-
|[registry](behavioral/registry.py)| keep track of all subclasses of a given class |
50
-
|[specification](behavioral/specification.py)| business rules can be recombined by chaining the business rules together using boolean logic |
51
-
|[state](behavioral/state.py)| logic is organized into a discrete number of potential states and the next state that can be transitioned to |
52
-
|[strategy](behavioral/strategy.py)| selectable operations over the same data |
53
-
|[template](behavioral/template.py)| an object imposes a structure but takes pluggable components |
54
-
|[visitor](behavioral/visitor.py)| invoke a callback for all items of a collection |
40
+
|[chain](patterns/behavioral/chain.py)| apply a chain of successive handlers to try and process the data |
41
+
|[catalog](patterns/behavioral/catalog.py)| general methods will call different specialized methods based on construction parameter |
42
+
|[chaining_method](patterns/behavioral/chaining_method.py)| continue callback next object method |
43
+
|[command](patterns/behavioral/command.py)| bundle a command and arguments to call later |
44
+
|[iterator](patterns/behavioral/iterator.py)| traverse a container and access the container's elements |
45
+
|[mediator](patterns/behavioral/mediator.py)| an object that knows how to connect other objects and act as a proxy |
46
+
|[memento](patterns/behavioral/memento.py)| generate an opaque token that can be used to go back to a previous state |
47
+
|[observer](patterns/behavioral/observer.py)| provide a callback for notification of events/changes to data |
48
+
|[publish_subscribe](patterns/behavioral/publish_subscribe.py)| a source syndicates events/data to 0+ registered listeners |
49
+
|[registry](patterns/behavioral/registry.py)| keep track of all subclasses of a given class |
50
+
|[specification](patterns/behavioral/specification.py)| business rules can be recombined by chaining the business rules together using boolean logic |
51
+
|[state](patterns/behavioral/state.py)| logic is organized into a discrete number of potential states and the next state that can be transitioned to |
52
+
|[strategy](patterns/behavioral/strategy.py)| selectable operations over the same data |
53
+
|[template](patterns/behavioral/template.py)| an object imposes a structure but takes pluggable components |
54
+
|[visitor](patterns/behavioral/visitor.py)| invoke a callback for all items of a collection |
55
55
56
56
__Design for Testability Patterns__:
57
57
58
58
| Pattern | Description |
59
59
|:-------:| ----------- |
60
-
|[setter_injection](dft/setter_injection.py)| the client provides the depended-on object to the SUT via the setter injection (implementation variant of dependency injection) |
60
+
|[setter_injection](patterns/dft/setter_injection.py)| the client provides the depended-on object to the SUT via the setter injection (implementation variant of dependency injection) |
61
61
62
62
__Fundamental Patterns__:
63
63
64
64
| Pattern | Description |
65
65
|:-------:| ----------- |
66
-
|[delegation_pattern](fundamental/delegation_pattern.py)| an object handles a request by delegating to a second object (the delegate) |
66
+
|[delegation_pattern](patterns/fundamental/delegation_pattern.py)| an object handles a request by delegating to a second object (the delegate) |
67
67
68
68
__Others__:
69
69
70
70
| Pattern | Description |
71
71
|:-------:| ----------- |
72
-
|[blackboard](other/blackboard.py)| architectural model, assemble different sub-system knowledge to build a solution, AI approach - non gang of four pattern |
73
-
|[graph_search](other/graph_search.py)| graphing algorithms - non gang of four pattern |
74
-
|[hsm](other/hsm/hsm.py)| hierarchical state machine - non gang of four pattern |
72
+
|[blackboard](patterns/other/blackboard.py)| architectural model, assemble different sub-system knowledge to build a solution, AI approach - non gang of four pattern |
73
+
|[graph_search](patterns/other/graph_search.py)| graphing algorithms - non gang of four pattern |
74
+
|[hsm](patterns/other/hsm/hsm.py)| hierarchical state machine - non gang of four pattern |
75
75
76
76
77
77
Contributing
@@ -86,15 +86,15 @@ Run `append_output.sh` (e.g. `./append_output.sh borg.py`) to generate/update it
86
86
##### Docstrings
87
87
Add module level description in form of a docstring with links to corresponding references or other useful information.
88
88
89
-
[strategy.py](behavioral/strategy.py) has a good example of detailed description,
90
-
but sometimes the shorter one as in [template.py](behavioral/template.py) would suffice.
89
+
[strategy.py](patterns/behavioral/strategy.py) has a good example of detailed description,
90
+
but sometimes the shorter one as in [template.py](patterns/behavioral/template.py) would suffice.
91
91
92
-
In some cases class-level docstring with doctest would also help (see [adapter.py](structural/adapter.py))
92
+
In some cases class-level docstring with doctest would also help (see [adapter.py](patterns/structural/adapter.py))
93
93
94
94
##### Python2/3 compatibility
95
95
Try to keep it (discussion is held in [issue #208](https://github.com/faif/python-patterns/issues/208))
96
96
- use new style classes (inherit from `object`)
97
97
- use `from future import print`
98
98
99
99
##### Update README
100
-
When everything else is done - update corresponding part of README.
100
+
When everything else is done - update corresponding part of README.
0 commit comments