|
1 | 1 | # Factory Pattern
|
2 | 2 | ```xml
|
3 | | -When using the Factory method design pattern, we gain an extra layer of encapsulation so |
4 | | -that our program can grow in a controlled environment. With the Factory method, we |
5 | | -delegate the creation of families of objects to a different package or object to abstract us |
6 | | -from the knowledge of the pool of possible objects we could use. Imagine that you want to |
7 | | -organize your holidays using a trip agency. You don't deal with hotels and traveling and |
8 | | -you just tell the agency the destination you are interested in so that they provide you with |
9 | | -everything you need. The trip agency represents a Factory of trips. |
| 3 | +When using the Factory method design pattern, we gain an extra layer of encapsulation so that our program can grow in a controlled environment. With the Factory method, we delegate the creation of families of objects to a different package or object to abstract us from the knowledge of the pool of possible objects we could use. Imagine that you want to |
| 4 | +organize your holidays using a trip agency. You don't deal with hotels and traveling and you just tell the agency the destination you are interested in so that they provide you with everything you need. The trip agency represents a Factory of trips. |
10 | 5 | ```
|
11 | 6 |
|
12 | 7 | ### Objectives
|
|
0 commit comments