Simple Factory - Design Pattern on PHP | OOP Design Patterns | What and How to use it?

preview_player
Показать описание
01:43 - Different groups of Design Patterns

03:00 - Analogy
Let's say you are building a house and you need doors. It will be a mess if every time you need a door you will make it manually. Instead, you will order doors from the factory.

03:17 - In a nutshell
A simple factory just generates an instance for the client without providing any instance logic.

03:27 - Example
First, we need the door interface and its implementation

Link on the Code Example:

08:00 - When to use?
When creating an object involves some kind of logic, and not just a few assignments, then it makes sense to delegate the task to a dedicated factory, and not repeat the same code all over the place

08:45 - Farewells with wishes

Reference on Resource

SUBSCRIBE TO CHANNEL:

Don't forget pls to click on 'Like', its giving additional motivation to work on channel.
Thank you for watching, for subscription and see you soon.

#mlaautomation #simplefactory #designpatterns #tutorial #interview #questions #answers #developer #programmer
Рекомендации по теме