Skip to content

Commit d38dd96

Browse files
committedFeb 27, 2021
updates
1 parent d9d0e25 commit d38dd96

File tree

318 files changed

+4656
-4480
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

318 files changed

+4656
-4480
lines changed
 

‎.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.vscode/
2-
site/
2+
site/
3+
__pycache__/

‎README.md

+76-27
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,86 @@
11
# Design Patterns In Python
22

3-
This course is about common GOF (Gang Of Four) Design Patterns implemented in Python.
3+
This repository focuses on the 23 famous GoF (Gang of Four) Design Patterns implemented in Python.
4+
5+
It is supplementary to my book titled **Design Patterns In Python**.
6+
7+
<table>
8+
<tr>
9+
<td>
10+
<img style="width:175;height=250;" src="./img/design_patterns_in_python_book.jpg">
11+
</td>
12+
<td>
13+
<a href="https://www.amazon.com/dp/B08XLJ8Z2J"><img src="./img/flag_us.gif">&nbsp; https://www.amazon.com/dp/B08XLJ8Z2J</a><br/>
14+
<a href="https://www.amazon.co.uk/dp/B08XLJ8Z2J"><img src="./img/flag_uk.gif">&nbsp; https://www.amazon.co.uk/dp/B08XLJ8Z2J</a><br/>
15+
<a href="https://www.amazon.de/dp/B08XLJ8Z2J"><img src="./img/flag_de.gif">&nbsp; https://www.amazon.de/dp/B08XLJ8Z2J</a><br/>
16+
<a href="https://www.amazon.fr/dp/B08XLJ8Z2J"><img src="./img/flag_fr.gif">&nbsp; https://www.amazon.fr/dp/B08XLJ8Z2J</a><br/>
17+
<a href="https://www.amazon.es/dp/B08XLJ8Z2J"><img src="./img/flag_es.gif">&nbsp; https://www.amazon.es/dp/B08XLJ8Z2J</a><br/>
18+
<a href="https://www.amazon.it/dp/B08XLJ8Z2J"><img src="./img/flag_it.gif">&nbsp; https://www.amazon.it/dp/B08XLJ8Z2J</a><br/>
19+
<a href="https://www.amazon.co.jp/dp/B08XLJ8Z2J"><img src="./img/flag_jp.gif">&nbsp; https://www.amazon.co.jp/dp/B08XLJ8Z2J</a><br/>
20+
<a href="https://www.amazon.ca/dp/B08XLJ8Z2J"><img src="./img/flag_ca.gif">&nbsp; https://www.amazon.ca/dp/B08XLJ8Z2J</a>
21+
</td>
22+
</tr>
23+
</table>
24+
25+
All the code examples in the book can be found in these pages.
426

527
A Design Pattern is a description or template that can be repeatedly applied to a commonly recurring problem in software design.
628

7-
You will find a familiarity with Design Patterns very useful when planning, discussing, developing, managing and documenting your applications from now on and into the future.
29+
A familiarity of Design Patterns will be very useful when planning, discussing, managing and documenting your applications from now on and into the future.
830

9-
You will learn these Design Patterns
31+
Also, throughout the book, as each design pattern is discussed and demonstrated using example code, I also introduce new python coding concepts with each new design pattern. So that as you progress through the book and try out the examples, you will also get experience and familiarity with some of the finer details of programming with python.
32+
33+
I had fun writing this book and coming up with new examples, and I hope you enjoy it as well.
34+
35+
So, in this book, you will learn about these 23 Design Patterns,
1036

1137
* Creational
12-
* [Factory](factory)
13-
* [Abstract Factory](abstract_factory)
14-
* [Builder](builder)
15-
* [Prototype](prototype)
16-
* Singleton
38+
- [Factory](factory)
39+
- [Abstract Factory](abstract_factory)
40+
- [Builder](builder)
41+
- [Prototype](prototype)
42+
- [Singleton](singleton)
1743
* Structural
18-
* [Decorator](decorator)
19-
* [Adapter](adapter)
20-
* [Facade](facade)
21-
* [Bridge](bridge)
22-
* [Composite](composite)
23-
* Flyweight
24-
* [Proxy](proxy)
25-
* Behavioural
26-
* [Command](command)
27-
* [Chain of Responsibility](chain_of_responsibility)
28-
* [Observer Pattern](observer)
29-
* Interpreter
30-
* [Iterator](iterator)
31-
* [Mediator](mediator)
32-
* Memento
33-
* State
34-
* Strategy
35-
* Template
36-
* Visitor
44+
- [Decorator](decorator)
45+
- [Adapter](adapter)
46+
- [Facade](facade)
47+
- [Bridge](bridge)
48+
- [Composite](composite)
49+
- [Flyweight](flyweight)
50+
- [Proxy](proxy)
51+
* Behavioral
52+
- [Command](command)
53+
- [Chain of Responsibility](chain_of_responsibility)
54+
- [Observer Pattern](observer)
55+
- [Interpreter](interpreter)
56+
- [Iterator](iterator)
57+
- [Mediator](mediator)
58+
- [Memento](memento)
59+
- [State](state)
60+
- [Strategy](strategy)
61+
- [Template](template)
62+
- [Visitor](visitor)
63+
64+
## Pattern Types
65+
66+
In the list of patterns above, there are Creational, Structural and Behavioral patterns.
67+
68+
* **Creational** : Abstracts the instantiation process so that there is a logical separation between how objects are composed and finally represented.
69+
* **Structural** : Structural patterns focus more on how classed and objects are composed using the different structural techniques, and to form structures with more or altered flexibility.
70+
* **Behavioral** : Are concerned with the inner algorithms, process flow, the assignment of responsibilities and the intercommunication between objects.
71+
72+
## Class Scope and Object Scope Patterns
73+
74+
Each pattern can be further specified whether it relates more specifically classes or instantiated objects.
75+
76+
Class scope patterns deal more with relationships between classes and their subclasses.
77+
78+
Object scope patterns deal more with relationships that can be altered at runtime
3779

80+
| Pattern | Description | Scope | Type |
81+
|---------------------------------------------------------------------------------------------------|--------------------------------------------|--------|-------------|
82+
| Factory, Abstract Factory | Defers object creation to subclasses | Class | Creational |
83+
| Builder, Prototype, Singleton | Defers object creation to objects | Object | Creational |
84+
| Adapter, Bridge, Composite, Decorator, Facade, Flyweight, Proxy | Describes a way to assemble objects | Object | Structural |
85+
| Interpreter, Template | Describes algorithms and flow control | Class | Behavioral |
86+
| Chain of Responsibility, Command, Iterator, Mediator, Memento, Observer, State, Strategy, Visitor | Describes how groups of objects co-operate | Object | Behavioral |

0 commit comments

Comments
 (0)