Dependency Injection - Design Patterns in JavaScript

  Рет қаралды 11,393

TomDoesTech

TomDoesTech

Күн бұрын

Repository: github.com/TomDoesTech/js-des...
Dependency injection is a strategy where an object has its dependencies injected into it. The receiving object is called the client and the object that is injected is called the service.
In simpler terms, dependency injection is passing something that the client depends on, in as arguments, instead of either building the service itself, or getting it from the global scope.
Why use dependency injection?
* Separation of concerns - Separates the construction and use a service
* Reusability - Services created outside of the client can be used anywhere
* Testing - A mocked service can easily be injected into the client during tests
Why not use dependency injection?
* Can be more work
* Can be just as simple to construct the service in the client
* Might move the logic to build services somewhere that's harder to manage
0:00 Introduction
1:49 Simple example of dependency injection
4:38 Dependency injection in NestJS
🌎 Follow me here:
Discord: / discord
Twitter: / tomdoes_tech
Facebook: / tomdoestech​
Instagram: / tomdoestech​
TikTok: / tomdoes_tech
☕ Buy me a coffee: www.buymeacoffee.com/tomn

Пікірлер: 13
@vaibhavdwivedi8660
@vaibhavdwivedi8660 2 жыл бұрын
Awesome! Waiting for more patterns: Abstract, Builder, Prototype, Singleton, Structural, Adapter, Bridge, Composite, Decorator, Facade, Flyweight, Proxy, Chain of Responsibility, Command, Iterator, Mediator, Memento, State, Strategy, Template Method, Visitor pattern
@TomDoesTech
@TomDoesTech 2 жыл бұрын
Thanks for the suggestions!
@netking767
@netking767 Ай бұрын
Real informative. Thanks
@kamertonaudiophileplayer847
@kamertonaudiophileplayer847 2 жыл бұрын
They are really nice architecture sessions. Thanks for providing them.
@TomDoesTech
@TomDoesTech 2 жыл бұрын
Glad you like them!
@trant4
@trant4 Жыл бұрын
Thank you for explaining this concept thoroughly!
@johnbeckham606
@johnbeckham606 2 жыл бұрын
Awesome! :) Maybe Facade pattern next? :D
@TomDoesTech
@TomDoesTech 2 жыл бұрын
Great suggestion!
@sky78710
@sky78710 Жыл бұрын
Please please please keep going please .. super ♥
@samchrist5464
@samchrist5464 2 жыл бұрын
Nice qnd useful video
@TomDoesTech
@TomDoesTech 2 жыл бұрын
Thanks a lot!
@zeeshanali7639
@zeeshanali7639 2 жыл бұрын
Thanks :)
@TomDoesTech
@TomDoesTech 2 жыл бұрын
Welcome!
Facade Pattern - Design Patterns in JavaScript
6:24
TomDoesTech
Рет қаралды 3,7 М.
Dependency Injection basics- Fun Fun Function
22:26
Fun Fun Function
Рет қаралды 153 М.
Como ela fez isso? 😲
00:12
Los Wagners
Рет қаралды 27 МЛН
КАРМАНЧИК 2 СЕЗОН 6 СЕРИЯ
21:57
Inter Production
Рет қаралды 389 М.
Dependency Inversion Principle Explained - SOLID Design Principles
13:00
Web Dev Simplified
Рет қаралды 153 М.
Factory Functions - Design Patterns in JavaScript
8:05
TomDoesTech
Рет қаралды 6 М.
TypeScript Dependency Injection using tsyringe
7:12
Kris Foster
Рет қаралды 30 М.
Dependency Injection Easily Explained
8:14
Software Developer Diaries
Рет қаралды 10 М.
Why Use Design Patterns When Python Has Functions?
23:23
ArjanCodes
Рет қаралды 97 М.
Mastering Dependency Injection In Golang
14:29
Anthony GG
Рет қаралды 42 М.
Why I decided to switch to the inject() function in Angular
6:10
Joshua Morony
Рет қаралды 52 М.
Inversion of Control, simplified
10:22
Bran van der Meer
Рет қаралды 3,5 М.
Dependency Injection in Flutter - You HAVE to Use it !
7:07
Flutter Guys
Рет қаралды 13 М.
Como ela fez isso? 😲
00:12
Los Wagners
Рет қаралды 27 МЛН