Member-only story

Design Patterns — Abstract Factory Pattern && Implementation in PHP

Backend Developer
2 min readFeb 20, 2022

--

Abstract Factory is a creational design pattern, which solves the problem of creating entire product families without specifying their concrete classes.

Abstract Factory

This design pattern is used for creating an interface for all related /dependent objects instead of concrete classes. Sounds good! Wait.. I did not get anything from this?

Abstract Factory defines an interface to create all the different products, but leaves the actual product creation to concrete factory classes.Each factory type corresponds to a specific product variety.

Before everything we should create a back bone of our structure which is an abstract class to define main component. We do not define any action in this abstract class/interface. We just create our main methods which return different abstract products.

The Abstract Factory interface declares creation methods for each distinct product type.

Each Concrete Factory corresponds to a specific variant…

--

--

Backend Developer
Backend Developer

Written by Backend Developer

Senior Php Developer | Javascript | Python

Responses (1)