Javascript Design Patterns 2023 : Factory Pattern

preview_player
Показать описание
This is a creational design pattern that you'll see in almost every medium size to big JavaScript project. The factory pattern allows to losely couple your code and the code that provides the instance of an object.

#designpatterns #designpatternsjs #designpatternsjavascript

0:00 Creating a JavaScript class
1:29 Creating a factory that returns an instance of an object
3:15 Letting the factory decide what type of object to return
7:11 When to use a factory
7:56 Letting the factory test if a property is provided
8:30 Factory Pattern in real life

Improve in HTML, CSS and JavaScript by subscribing to our newsletter:
Рекомендации по теме
Комментарии
Автор

oh thanks You did the video. Brilliant. You are a star 🙌

daniusofficial
Автор

This is the most eloquent tutorial on Factory Functions that I've seen!

bobm
Автор

can we just use a factory function, that returns an object (we can also pass an options object and perform tests) ? the explanation was so clear, thank you so much Sir.

siraj_safed