added brief descriptions of structural patterns
This commit is contained in:
@@ -809,6 +809,8 @@ ___
|
|||||||
|
|
||||||
##### Adapter Pattern
|
##### Adapter Pattern
|
||||||
|
|
||||||
|
Wrap an object into an interface which the client expects.
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from pypattyrn.structural.adapter import Adapter
|
from pypattyrn.structural.adapter import Adapter
|
||||||
|
|
||||||
@@ -870,6 +872,8 @@ else:
|
|||||||
|
|
||||||
##### Composite Pattern
|
##### Composite Pattern
|
||||||
|
|
||||||
|
Compose objects into a tree structure of objects that can be treated uniformly.
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from pypattyrn.structural.composite import Composite
|
from pypattyrn.structural.composite import Composite
|
||||||
|
|
||||||
@@ -926,6 +930,8 @@ assert not leaf_three.did_something
|
|||||||
|
|
||||||
##### Decorator Pattern
|
##### Decorator Pattern
|
||||||
|
|
||||||
|
Attach additional functionality to functions.
|
||||||
|
|
||||||
```python
|
```python
|
||||||
import time
|
import time
|
||||||
from pypattyrn.structural.decorator import DecoratorSimple, DecoratorComplex, CallWrapper
|
from pypattyrn.structural.decorator import DecoratorSimple, DecoratorComplex, CallWrapper
|
||||||
@@ -987,6 +993,8 @@ assert (10, False) == slow_class.slow_function_false(10)
|
|||||||
|
|
||||||
##### Flyweight Pattern
|
##### Flyweight Pattern
|
||||||
|
|
||||||
|
Share data with other similar objects to increase efficiency.
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from pypattyrn.structural.flyweight import FlyweightMeta
|
from pypattyrn.structural.flyweight import FlyweightMeta
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user