Skip to content

Commit 5ebb46c

Browse files
committed
Fix docs style for github pages
1 parent 4695d29 commit 5ebb46c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ Here **polymorphism** is often used.
5656

5757
### Factory method
5858
Factory method defines an interface for creating an object but defers object instantiation to run time.
59+
5960
```python
6061
from abc import ABC, abstractmethod
6162

@@ -118,12 +119,14 @@ square: Shape = factory.shape()
118119
print(square.__class__.__name__)
119120
print(square.draw())
120121
```
122+
121123
Factory encapsulates objects creation. Factory is an object that is specialized in creation of other objects.
122124
- Benefits:
123125
- Useful when you are not sure what kind of object you will be needed eventually.
124126
- Application need to decide what class it has to use.
125127
- Exercise:
126128
- Pet shop is selling dogs but now it sells cats too.
129+
127130
```python
128131
from abc import ABC, abstractmethod
129132

@@ -325,6 +328,7 @@ Python has global variables and modules which are **_singletons_**. Singleton al
325328
Useful if you want to share cached information to multiple objects.
326329

327330
**Classic singleton**
331+
328332
```python
329333
from typing import Any, Dict
330334

@@ -372,6 +376,7 @@ print(bar_one is bar_two)
372376
```
373377

374378
**Borg singleton**
379+
375380
```python
376381
from typing import Dict, Any
377382

@@ -417,6 +422,7 @@ Builder reduces complexity of building objects.
417422
- Product: object being built
418423
- Exercise:
419424
- Build a car object
425+
420426
```python
421427
from abc import ABC, abstractmethod
422428

@@ -1427,6 +1433,7 @@ Composite pattern is related to iterator pattern.
14271433
- Will iterate over a certain point based on client input
14281434

14291435
**Iterator function**
1436+
14301437
```python
14311438
from typing import Iterator, Tuple, List
14321439

@@ -1529,6 +1536,7 @@ This type of pattern decouples responsibility. Composite is related to this desi
15291536
- Successor
15301537
- Concrete Handler
15311538
- Checks if it can handle the request
1539+
15321540
```python
15331541
from abc import abstractmethod
15341542
from typing import List

0 commit comments

Comments
 (0)