/DesignPatterns

Design Patterns

Primary LanguageJavaGNU General Public License v3.0GPL-3.0

DesignPatterns

Exploring Design Patterns with Java

Factory Method: Define an interface for creating an object, but let the subclasses decide which class to instantiate. The Factory method lets a class defer instantiation to subclasses

Abstract Factory: Provides an interface for creating families of related or dependent objects without specifying their concrete classes.

AbstractFactory pattern uses composition to delegate responsibility of creating object to another class while Factory method pattern uses inheritance and relies on derived class or sub class to create object