From 823c58bef2197c30d7f8a40c2701973ee9a04ea2 Mon Sep 17 00:00:00 2001 From: Denise Date: Wed, 2 Oct 2019 08:53:57 +0100 Subject: [PATCH] added new information (#937) --- abstract-factory/README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/abstract-factory/README.md b/abstract-factory/README.md index 0bf86dfa6..0084030b6 100644 --- a/abstract-factory/README.md +++ b/abstract-factory/README.md @@ -169,15 +169,20 @@ Use the Abstract Factory pattern when * 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 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: * Selecting to call the appropriate implementation of FileSystemAcmeService or DatabaseAcmeService or NetworkAcmeService at runtime. * Unit test case writing becomes much easier +* UI tools for different OS ## Consequences: * 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