Skip to content

Commit 1bbc597

Browse files
authored
Merge pull request iluwatar#575 from prafful1/master
Few additions in README
2 parents 4d6467e + fb26d42 commit 1bbc597

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

abstract-factory/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,22 @@ Use the Abstract Factory pattern when
2727
* a system should be configured with one of multiple families of products
2828
* a family of related product objects is designed to be used together, and you need to enforce this constraint
2929
* you want to provide a class library of products, and you want to reveal just their interfaces, not their implementations
30+
* the lifetime of the dependency is conceptually shorter than the lifetime of the consumer.
31+
* you need a run-time value to construct a particular dependency
32+
* you want to decide which product to call from a family at runtime.
33+
* you need to supply one or more parameters only known at run-time before you can resolve a dependency.
34+
35+
## Use Cases:
36+
37+
* Selecting to call the appropriate implementation of FileSystemAcmeService or DatabaseAcmeService or NetworkAcmeService at runtime.
38+
* Unit test case writing becomes much easier
39+
40+
## Consequences:
41+
42+
* Dependency injection in java hides the service class dependencies that can lead to runtime errors that would have been caught at compile time.
43+
44+
45+
3046

3147
## Real world examples
3248

0 commit comments

Comments
 (0)