Magento Expert Forum - Improve your Magento experience

Results 1 to 5 of 5

What is Factory Class and how it is work?

  1. #1

  2. #2
    Junior Member kajal's Avatar
    Join Date
    Sep 2014
    Location
    Bangalore
    Posts
    957
    Thanks
    0
    Thanked 13 Times in 13 Posts

    Default

    A Secure and Accessible Website
    Page Speed (Including Mobile Page Speed)
    Mobile Friendliness
    Domain Age, URL, and Authority
    Optimized Content
    Technical SEO
    User Experience (RankBrain)
    Links
    Social Signals
    Real Business Information

  3. #3
    Junior Member
    Join Date
    Jun 2018
    Location
    surat
    Posts
    293
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Default

    Quote Originally Posted by kajal View Post
    A Secure and Accessible Website
    Page Speed (Including Mobile Page Speed)
    Mobile Friendliness
    Domain Age, URL, and Authority
    Optimized Content
    Technical SEO
    User Experience (RankBrain)
    Links
    Social Signals
    Real Business Information
    Don't you think this answer does not fit at all?

  4. #4
    Junior Member
    Join Date
    Sep 2018
    Location
    United Kingdom
    Posts
    183
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default

    Factory Method: Defines an interface for creating an object, but let's the classes that implement the interface decide which class to instantiate. ... Abstract Factory: Provides an interface for creating families of related or dependent objects without specifying their concrete classes.

  5. #5
    Junior Member
    Join Date
    Jul 2018
    Posts
    230
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Factory Method: Defines an interface for creating an object, but let's the classes that implement the interface decide which class to instantiate. ... Abstract Factory: Provides an interface for creating families of related or dependent objects without specifying their concrete classes.

    As the business grew, more and more toys came into production and the CEO was very happy with the business’ financial growth. However, the development team’s office the nightmare was just beginning. The developers were tasked to modify the produceToy() function with the introduction of every new toy. It has violated the open/close principle. Which states “software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification”. Every new toy brought in modifications of the produceToy() function.

    It was time for refactoring. 
Let’s take a look at the situation here. What was the real issue with produceToy function? A concrete class was instantiated inside ToysFactory and messed up the produceToy() function. The ToysFactory class was tied to the concrete classes of toys. Let’s the issue.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •