Giter Club home page Giter Club logo

design-pattrns / abstract-factory-pattern Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 1.0 45 KB

In the Abstract Factory pattern, we get rid of if-else block and have a factory class for each sub-class. Then an Abstract Factory class that will return the sub-class based on the input factory class. At first, it seems confusing but once you see the implementation, it’s really easy to grasp and understand the minor difference between Factory and Abstract Factory pattern.

HTML 3.45% Java 96.55%
abstract design designpa design-patterns factory patterns

abstract-factory-pattern's Introduction

AbstractFactoryPattern

Note

The Abstract Factory design pattern is similar to the Factory Method design pattern just discussed. Both solve the problem of how to create objects that conform to an abstract interface in a way that moves the responsibility for creating the objects outside of the client. The client decides when the objects are created but another class outside of the client decides what classes are created.

What distinguishes the Abstract Factory design pattern from the Factory Method design pattern is that the Abstract Factory design pattern is designed to create families of related objects. The key word here is family. Factory Method is designed to create one type of object. Abstract Factory is designed to create a family of related products.

Diagrams

  • Base class diagram

alt text

abstract-factory-pattern's People

Contributors

mohamedebrahim96 avatar

Watchers

James Cloos avatar  avatar

Forkers

nvard2021

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.