added new information (#937)
This commit is contained in:
parent
b03e0b8c35
commit
823c58bef2
@ -169,15 +169,20 @@ Use the Abstract Factory pattern when
|
|||||||
* you need a run-time value to construct a particular dependency
|
* you need a run-time value to construct a particular dependency
|
||||||
* you want to decide which product to call from a family at runtime.
|
* you want to decide which product to call from a family at runtime.
|
||||||
* you need to supply one or more parameters only known at run-time before you can resolve a dependency.
|
* you need to supply one or more parameters only known at run-time before you can resolve a dependency.
|
||||||
|
* when you need consistency among products
|
||||||
|
* you don’t want to change existing code when adding new products or families of products to the program.
|
||||||
|
|
||||||
## Use Cases:
|
## Use Cases:
|
||||||
|
|
||||||
* Selecting to call the appropriate implementation of FileSystemAcmeService or DatabaseAcmeService or NetworkAcmeService at runtime.
|
* Selecting to call the appropriate implementation of FileSystemAcmeService or DatabaseAcmeService or NetworkAcmeService at runtime.
|
||||||
* Unit test case writing becomes much easier
|
* Unit test case writing becomes much easier
|
||||||
|
* UI tools for different OS
|
||||||
|
|
||||||
## Consequences:
|
## Consequences:
|
||||||
|
|
||||||
* Dependency injection in java hides the service class dependencies that can lead to runtime errors that would have been caught at compile time.
|
* Dependency injection in java hides the service class dependencies that can lead to runtime errors that would have been caught at compile time.
|
||||||
|
* While the pattern is great when creating predefined objects, adding the new ones might be challenging.
|
||||||
|
* The code may become more complicated than it should be, since a lot of new interfaces and classes are introduced along with the pattern.
|
||||||
|
|
||||||
|
|
||||||
## Tutorial
|
## Tutorial
|
||||||
|
Loading…
x
Reference in New Issue
Block a user