Factory Pattern promotes loose coupling code by separating implementation from its client. The pattern is useful when we have more than one implementation of an interface and selection of implementing class is dictated by context such as calling component or request parameters. We have to use Factory Pattern and Dependency Injection.
Sort: