File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,28 @@ graph LR
128128| [ graph_search] ( patterns/other/graph_search.py ) | graphing algorithms - non gang of four pattern |
129129| [ hsm] ( patterns/other/hsm/hsm.py ) | hierarchical state machine - non gang of four pattern |
130130
131+ ## 🚫 Anti-Patterns
132+
133+ This section lists some common design patterns that are ** not recommended** in Python and explains why.
134+
135+ ### 🧱 Singleton
136+ ** Why not:**
137+ - Python modules are already singletons — every module is imported only once.
138+ - Explicit singleton classes add unnecessary complexity.
139+ - Better alternatives: use module-level variables or dependency injection.
140+
141+ ### 🌀 God Object
142+ ** Why not:**
143+ - Centralizes too much logic in a single class.
144+ - Makes code harder to test and maintain.
145+ - Better alternative: split functionality into smaller, cohesive classes.
146+
147+ ### 🔁 Inheritance overuse
148+ ** Why not:**
149+ - Deep inheritance trees make code brittle.
150+ - Prefer composition and delegation.
151+ - “Favor composition over inheritance.”
152+
131153## Videos
132154
133155* [ Design Patterns in Python by Peter Ullrich] ( https://www.youtube.com/watch?v=bsyjSW46TDg )
You can’t perform that action at this time.
0 commit comments