Giter Site home page Giter Site logo

quynhchi1009 / factorymethod Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 2 KB

Factory Method is a creational design pattern that provides an interface for creating objects in a superclass, but allows subclasses to alter the type of objects that will be created.

Java 100.00%
design-patterns factory-method factory-method-pattern

factorymethod's Introduction

FactoryMethod

Factory Method is a creational design pattern that provides an interface for creating objects in a superclass, but allows subclasses to alter the type of objects that will be created.

  1. Replace direct object construction calls (using the new operator) with calls to a special factory method.
  2. Limitation: subclasses may return different types of products <=> these products have a common base class or interface.
  3. Use when:
  • don’t know beforehand the exact types and dependencies of the objects your code should work with
  • want to provide users of your library or framework with a way to extend its internal components.
  • want to save system resources by reusing existing objects instead of rebuilding them each time.

Source: https://refactoring.guru/design-patterns/factory-method

factorymethod's People

Contributors

quynhchi1009 avatar

Watchers

 avatar

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.