Skip to content

Commit 450eba7

Browse files
committed
docs(readme): update documentation
1 parent 0f6b735 commit 450eba7

File tree

11 files changed

+40
-0
lines changed

11 files changed

+40
-0
lines changed

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,72 +5,112 @@
55
* Mergulho nos padrões de projeto - Alexander Shvets
66
* Refactoring Guru - refactoring.guru
77

8+
>
89
### Creational Patterns
910
---
11+
12+
>
1013
#### Factory Method
1114

15+
<img src="./assets/factory-method.png" width="100%">
16+
1217
> Factory Method is a creational design pattern that provides an interface for creating objects in a superclass, but allows subclasses to alter the type of objects that will be created.
1318
1419
* Use the Factory Method when you don’t know beforehand the exact types and dependencies of the objects your code should work with.
1520
* Use the Factory Method when you want to provide users of your library or framework with a way to extend its internal components.
1621
* Use the Factory Method when you want to save system resources by reusing existing objects instead of rebuilding them each time.
1722

23+
>
1824
1925
#### Abstract Factory
2026

27+
<img src="./assets/abstract-factory.png" width="100%">
28+
2129
> Abstract Factory is a creational design pattern that lets you produce families of related objects without specifying their concrete classes.
2230
2331
* Use the Abstract Factory when your code needs to work with various families of related products, but you don’t want it to depend on the concrete classes of those products—they might be unknown beforehand or you simply want to allow for future extensibility.
2432

33+
>
2534
#### Builder
2635

36+
<img src="./assets/builder.png" width="100%">
37+
2738
> Builder is a creational design pattern that lets you construct complex objects step by step. The pattern allows you to produce different types and representations of an object using the same construction code.
2839
2940
* Use the Builder pattern to get rid of a “telescopic constructor”.
3041
* Use the Builder pattern when you want your code to be able to create different representations of some product (for example, stone and wooden houses).
3142
* Use the Builder to construct Composite trees or other complex objects.
3243

44+
>
3345
#### Prototype
3446

47+
<img src="./assets/prototype.png" width="100%">
48+
3549
> Prototype is a creational design pattern that lets you copy existing objects without making your code dependent on their classes.
3650
3751
* Use the Prototype pattern when your code shouldn’t depend on the concrete classes of objects that you need to copy.
3852
* Use the pattern when you want to reduce the number of subclasses that only differ in the way they initialize their respective objects. Somebody could have created these subclasses to be able to create objects with a specific configuration.
3953

54+
>
4055
#### Singleton
4156

57+
<img src="./assets/singleton.png" width="100%">
58+
4259
> Singleton is a creational design pattern that lets you ensure that a class has only one instance, while providing a global access point to this instance.
4360
4461
* Use the Singleton pattern when a class in your program should have just a single instance available to all clients; for example, a single database object shared by different parts of the program.
4562
* Use the Singleton pattern when you need stricter control over global variables.
4663

64+
>
4765
### Structural Patterns
4866
---
67+
>
4968
#### Adapter
5069

70+
<img src="./assets/adapter.png" width="100%">
71+
5172
> Adapter is a structural design pattern that allows objects with incompatible interfaces to collaborate.
5273
5374
* Use the Adapter class when you want to use some existing class, but its interface isn’t compatible with the rest of your code.
5475
* Use the pattern when you want to reuse several existing subclasses that lack some common functionality that can’t be added to the superclass.
5576

77+
>
5678
#### Bridge
5779

80+
<img src="./assets/bridge.png" width="100%">
81+
5882
> Bridge is a structural design pattern that lets you split a large class or a set of closely related classes into two separate hierarchies—abstraction and implementation—which can be developed independently of each other.
5983
6084
* Use the Bridge pattern when you want to divide and organize a monolithic class that has several variants of some functionality (for example, if the class can work with various database servers).
6185
* Use the pattern when you need to extend a class in several orthogonal (independent) dimensions.
6286
* Use the Bridge if you need to be able to switch implementations at runtime.
6387

88+
>
6489
#### Composite
6590

91+
<img src="./assets/composite.png" width="100%">
92+
6693
> Composite is a structural design pattern that lets you compose objects into tree structures and then work with these structures as if they were individual objects.
6794
6895
* Use the Composite pattern when you have to implement a tree-like object structure.
6996
* Use the pattern when you want the client code to treat both simple and complex elements uniformly.
7097

98+
>
7199
#### Decorator
72100

101+
<img src="./assets/decorator.png" width="100%">
102+
73103
> Decorator is a structural design pattern that lets you attach new behaviors to objects by placing these objects inside special wrapper objects that contain the behaviors.
74104
75105
* Use the Decorator pattern when you need to be able to assign extra behaviors to objects at runtime without breaking the code that uses these objects.
76106
* Use the pattern when it’s awkward or not possible to extend an object’s behavior using inheritance.
107+
108+
>
109+
#### Facade
110+
111+
<img src="./assets/facade.png" width="100%">
112+
113+
> Facade is a structural design pattern that provides a simplified interface to a library, a framework, or any other complex set of classes.
114+
115+
* Use the Facade pattern when you need to have a limited but straightforward interface to a complex subsystem.
116+
* Use the Facade when you want to structure a subsystem into layers.

assets/abstract-factory.png

20.1 KB
Loading

assets/adapter.png

14.1 KB
Loading

assets/bridge.png

27.3 KB
Loading

assets/builder.png

25.6 KB
Loading

assets/composite.png

20 KB
Loading

assets/decorator.png

28.8 KB
Loading

assets/facade.png

18.4 KB
Loading

assets/factory-method.png

19 KB
Loading

assets/prototype.png

28 KB
Loading

0 commit comments

Comments
 (0)