Skip to content

Commit 823c58b

Browse files
dignatiluwatar
authored andcommitted
added new information (iluwatar#937)
1 parent b03e0b8 commit 823c58b

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎abstract-factory/README.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,15 +169,20 @@ Use the Abstract Factory pattern when
169169
* you need a run-time value to construct a particular dependency
170170
* you want to decide which product to call from a family at runtime.
171171
* you need to supply one or more parameters only known at run-time before you can resolve a dependency.
172+
* when you need consistency among products
173+
* you don’t want to change existing code when adding new products or families of products to the program.
172174

173175
## Use Cases:
174176

175177
* Selecting to call the appropriate implementation of FileSystemAcmeService or DatabaseAcmeService or NetworkAcmeService at runtime.
176178
* Unit test case writing becomes much easier
179+
* UI tools for different OS
177180

178181
## Consequences:
179182

180183
* Dependency injection in java hides the service class dependencies that can lead to runtime errors that would have been caught at compile time.
184+
* While the pattern is great when creating predefined objects, adding the new ones might be challenging.
185+
* The code may become more complicated than it should be, since a lot of new interfaces and classes are introduced along with the pattern.
181186

182187

183188
## Tutorial

0 commit comments

Comments
 (0)