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
|[adapter](structural/adapter.py)| adapt one interface to another using a white-list |
30
27
|[bridge](structural/bridge.py)| a client-provider middleman to soften interface changes |
31
-
|[composite](structural/composite.py)|encapsulate and provide access to a number of different objects|
28
+
|[composite](structural/composite.py)|lets clients treat individual objects and compositions uniformly|
32
29
|[decorator](structural/decorator.py)| wrap functionality with other functionality in order to affect outputs |
33
30
|[facade](structural/facade.py)| use one class as an API to a number of others |
34
31
|[flyweight](structural/flyweight.py)| transparently reuse existing instances of objects with similar/identical state |
@@ -75,3 +72,29 @@ __Others__:
75
72
|[blackboard](other/blackboard.py)| architectural model, assemble different sub-system knowledge to build a solution, AI approach - non gang of four pattern |
76
73
|[graph_search](other/graph_search.py)| graphing algorithms - non gang of four pattern |
77
74
|[hsm](other/hsm/hsm.py)| hierarchical state machine - non gang of four pattern |
75
+
76
+
77
+
Contributing
78
+
------------
79
+
When an implementation is added or modified, please review the following guidelines:
80
+
81
+
##### Output
82
+
All files with example patterns have `### OUTPUT ###` section at the bottom.
83
+
84
+
Run `append_output.sh` (e.g. `./append_output.sh borg.py`) to generate/update it.
85
+
86
+
##### Docstrings
87
+
Add module level description in form of a docstring with links to corresponding references or other useful information.
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.
91
+
92
+
In some cases class-level docstring with doctest would also help (see [adapter.py](structural/adapter.py))
93
+
94
+
##### Python2/3 compatibility
95
+
Try to keep it (discussion is held in [issue #208](https://github.com/faif/python-patterns/issues/208))
96
+
- use new style classes (inherit from `object`)
97
+
- use `from future import print`
98
+
99
+
##### Update README
100
+
When everything else is done - update corresponding part of README.
0 commit comments