SlideShare a Scribd company logo
1 of 32
There are two ways to explain a pattern…
LIKE AN ARCHITECT
OR THE OTHER WAY
This strip was made by
CKGrafico mixin some strips
from, all the rights are for
commitstrip, and their awesome
work.
Can you help me
with a pattern?
Ye
s!
And this is the new
pattern to study
this week
FIRST YOU USE IT WITHOUT KNOWLEDGE
This strip was made by
CKGrafico mixin some strips
from, all the rights are for
commitstrip, and their awesome
work.
Can you help me
with a pattern?
Ye
s!
And this is the new
pattern to study
this week
This strip was made by
CKGrafico mixin some strips
from, all the rights are for
commitstrip, and their awesome
work.
Can you help me
with a pattern?
Ye
s!
And this is the new
pattern to study
this week
AND YOU DISCOVER THE PATTERN
This strip was made by
CKGrafico mixin some strips
from, all the rights are for
commitstrip, and their awesome
work.
Can you help me
with a pattern?
Ye
s!
And this is the new
pattern to study
this week
This strip was made by
CKGrafico mixin some strips
from, all the rights are for
commitstrip, and their awesome
work.
Can you help me
with a pattern?
Ye
s!
And this is the new
pattern to study
this week
YOU INVESTIGATE ALONE
This strip was made by
CKGrafico mixin some strips
from, all the rights are for
commitstrip, and their awesome
work.
Can you help me
with a pattern?
Ye
s!
And this is the new
pattern to study
this week
This strip was made by
CKGrafico mixin some strips
from, all the rights are for
commitstrip, and their awesome
work.
Can you help me
with a pattern?
Ye
s!
And this is the new
pattern to study
this week
DISCUSS WITH TEAMMATES
This strip was made by
CKGrafico mixin some strips
from, all the rights are for
commitstrip, and their awesome
work.
Can you help me
with a pattern?
Ye
s!
And this is the new
pattern to study
this week
This strip was made by
CKGrafico mixin some strips
from, all the rights are for
commitstrip, and their awesome
work.
Can you help me
with a pattern?
Ye
s!
And this is the new
pattern to study
this week
HAVE INTERNAL TRAININGS ABOUT IT
AND YOU GO TO TALKS, HERE WE ARE!
YOU CAN INJECT
DEPENDENCIES IN YOUR
COMPONENTS, LET'S DO IT!
QuiqueFdezGuerra
SoftwareEngineer
PlainConcepts
@CKGrafico
WHY THIS PATTERN?
A B
- One of the most used patterns in backend for
coupling.
- If A depends on B and B is broken, you should
change A.
- A has to manage the life time of B.
- Mocking dependencies is not easy.
We want to make our classes independent from
creating the instance of the dependencies.
A
THE SOLID PRINCIPLE
A BIB
Dependency Inversion Principle
One module should not depend of other
module, they both should depend of an
abstraction
Injector
(container?)
Inversion of Control ( IoC )
THE DESIGN PRINCIPLE
A B A
Creates
B?
B ☆
Using IoC, when one class depends on other class,
the first should not manage the life time of the
second, this should be done outside.
THE (FAMOUS) PATTERN
A Injector
(container?)
IB?
B
D
C E
Dependency Injection
We should have one object supplies the dependency
of another object helping on Inversion of Control,
and we should use abstractions to apply Dependency
Inversion.
And how we work with that?
WE HAVE A SERVICE
AND WANT TO USE
OTHER SERVICE
How we usually import our dependencies?
IMPORTING AN OBJECT ’’’’’Singleton’’’’’
IMPORTING A CLASS ’’’’Transient’’’’’
Congratulations! That was your first DI approach
Object singleton, class transient, no
container, the service has too much
responsibility… abstractions?
First step in the evolution chain, semi-injection
1st STEP: SEMI-INJECTION
2nd STEP: AUTO-INJECTION
3rd STEP: INJECTION WITH CONTAINER
4th STEP: REALISTIC WORLD
5th STEP: ADDING ABSTRACTIONS
6th STEP: MOVING TO COMPONENTS
Ok, but how can I do that Quique?
InversifyJS
Inversify-props
@
helpdev.org
github.com/CKGrafico/inversify-props
twitter.com/CKGrafico
plainconcepts.com

More Related Content

Similar to YOU CAN INJECT DEPENDENCIES IN YOUR COMPONENTS, LET'S DO IT.

Unit 67 3 d animation production log
Unit 67 3 d animation production logUnit 67 3 d animation production log
Unit 67 3 d animation production logluisfvazquez1
 
7 Punctuation Secrets to Influence and Persuade
7 Punctuation Secrets to Influence and Persuade7 Punctuation Secrets to Influence and Persuade
7 Punctuation Secrets to Influence and PersuadeDeepa Vijayan
 
ANT4930 Final Project
ANT4930 Final ProjectANT4930 Final Project
ANT4930 Final Projectalangere
 
What Can I Do Now That I Couldn't Do Before?
What Can I Do Now That I Couldn't Do Before?What Can I Do Now That I Couldn't Do Before?
What Can I Do Now That I Couldn't Do Before?Darren Kuropatwa
 
Newbie's Guide to Contributing to Babel
Newbie's Guide to Contributing to BabelNewbie's Guide to Contributing to Babel
Newbie's Guide to Contributing to BabelJosh Justice
 
Checklist for AS Video Brief
Checklist for AS Video BriefChecklist for AS Video Brief
Checklist for AS Video Briefnpamediastudies
 
Paco Viñoly, Designing in a Developer World, WarmGun 2013
Paco Viñoly, Designing in a Developer World, WarmGun 2013Paco Viñoly, Designing in a Developer World, WarmGun 2013
Paco Viñoly, Designing in a Developer World, WarmGun 2013500 Startups
 
JS Fest 2019/Autumn. Alexandre Gomes. Embrace the "react fatigue"
JS Fest 2019/Autumn. Alexandre Gomes. Embrace the "react fatigue"JS Fest 2019/Autumn. Alexandre Gomes. Embrace the "react fatigue"
JS Fest 2019/Autumn. Alexandre Gomes. Embrace the "react fatigue"JSFestUA
 

Similar to YOU CAN INJECT DEPENDENCIES IN YOUR COMPONENTS, LET'S DO IT. (12)

Unit 67 3 d animation production log
Unit 67 3 d animation production logUnit 67 3 d animation production log
Unit 67 3 d animation production log
 
Dagger 2, 2 years later
Dagger 2, 2 years laterDagger 2, 2 years later
Dagger 2, 2 years later
 
7 Punctuation Secrets to Influence and Persuade
7 Punctuation Secrets to Influence and Persuade7 Punctuation Secrets to Influence and Persuade
7 Punctuation Secrets to Influence and Persuade
 
TP # 4: Web 2.0 Tools
TP # 4: Web 2.0 ToolsTP # 4: Web 2.0 Tools
TP # 4: Web 2.0 Tools
 
ANT4930 Final Project
ANT4930 Final ProjectANT4930 Final Project
ANT4930 Final Project
 
Refração da luz e o olho humano
Refração da luz e o olho humanoRefração da luz e o olho humano
Refração da luz e o olho humano
 
Tensorflow go
Tensorflow goTensorflow go
Tensorflow go
 
What Can I Do Now That I Couldn't Do Before?
What Can I Do Now That I Couldn't Do Before?What Can I Do Now That I Couldn't Do Before?
What Can I Do Now That I Couldn't Do Before?
 
Newbie's Guide to Contributing to Babel
Newbie's Guide to Contributing to BabelNewbie's Guide to Contributing to Babel
Newbie's Guide to Contributing to Babel
 
Checklist for AS Video Brief
Checklist for AS Video BriefChecklist for AS Video Brief
Checklist for AS Video Brief
 
Paco Viñoly, Designing in a Developer World, WarmGun 2013
Paco Viñoly, Designing in a Developer World, WarmGun 2013Paco Viñoly, Designing in a Developer World, WarmGun 2013
Paco Viñoly, Designing in a Developer World, WarmGun 2013
 
JS Fest 2019/Autumn. Alexandre Gomes. Embrace the "react fatigue"
JS Fest 2019/Autumn. Alexandre Gomes. Embrace the "react fatigue"JS Fest 2019/Autumn. Alexandre Gomes. Embrace the "react fatigue"
JS Fest 2019/Autumn. Alexandre Gomes. Embrace the "react fatigue"
 

More from Quique Fdez Guerra

Frontend 101 Initializing a Frontend Project using React
Frontend 101 Initializing a Frontend Project using ReactFrontend 101 Initializing a Frontend Project using React
Frontend 101 Initializing a Frontend Project using ReactQuique Fdez Guerra
 
Empowering Vue with Typescript, Inversify, Vuex and some other super tools
Empowering Vue with Typescript, Inversify, Vuex and some other super toolsEmpowering Vue with Typescript, Inversify, Vuex and some other super tools
Empowering Vue with Typescript, Inversify, Vuex and some other super toolsQuique Fdez Guerra
 
Real and scalable applications with Nuxt, Vuex and TypeScript
Real and scalable applications with Nuxt, Vuex and TypeScriptReal and scalable applications with Nuxt, Vuex and TypeScript
Real and scalable applications with Nuxt, Vuex and TypeScriptQuique Fdez Guerra
 
Lord of the codes: Visual Studio y todo lo que puedes hacer con él
Lord of the codes: Visual Studio y todo lo que puedes hacer con élLord of the codes: Visual Studio y todo lo que puedes hacer con él
Lord of the codes: Visual Studio y todo lo que puedes hacer con élQuique Fdez Guerra
 
Más productivos con Apache Cordova e Ionic
Más productivos con Apache Cordova e IonicMás productivos con Apache Cordova e Ionic
Más productivos con Apache Cordova e IonicQuique Fdez Guerra
 
Mejora de la atención odontológica para países en desarrollo
Mejora de la atención odontológica para países en desarrolloMejora de la atención odontológica para países en desarrollo
Mejora de la atención odontológica para países en desarrolloQuique Fdez Guerra
 
HTML5 en el universo Windows (Apps universales)
HTML5 en el universo Windows (Apps universales)HTML5 en el universo Windows (Apps universales)
HTML5 en el universo Windows (Apps universales)Quique Fdez Guerra
 
#Win8JSApps | 4.- Métodos de desarrollo
#Win8JSApps | 4.- Métodos de desarrollo#Win8JSApps | 4.- Métodos de desarrollo
#Win8JSApps | 4.- Métodos de desarrolloQuique Fdez Guerra
 
Introduccion a la programacion (Pseudocódigo + JavaScript)
Introduccion a la programacion (Pseudocódigo + JavaScript)Introduccion a la programacion (Pseudocódigo + JavaScript)
Introduccion a la programacion (Pseudocódigo + JavaScript)Quique Fdez Guerra
 
Pasado, presente y Futuro de las aplicaciones en HTML5
Pasado, presente y Futuro de las aplicaciones en HTML5Pasado, presente y Futuro de las aplicaciones en HTML5
Pasado, presente y Futuro de las aplicaciones en HTML5Quique Fdez Guerra
 
Repaso conceptos básicos de JavaScript
Repaso conceptos básicos de JavaScriptRepaso conceptos básicos de JavaScript
Repaso conceptos básicos de JavaScriptQuique Fdez Guerra
 

More from Quique Fdez Guerra (20)

Frontend 101 Initializing a Frontend Project using React
Frontend 101 Initializing a Frontend Project using ReactFrontend 101 Initializing a Frontend Project using React
Frontend 101 Initializing a Frontend Project using React
 
Empowering Vue with Typescript, Inversify, Vuex and some other super tools
Empowering Vue with Typescript, Inversify, Vuex and some other super toolsEmpowering Vue with Typescript, Inversify, Vuex and some other super tools
Empowering Vue with Typescript, Inversify, Vuex and some other super tools
 
Why TypeScript?
Why TypeScript?Why TypeScript?
Why TypeScript?
 
Real and scalable applications with Nuxt, Vuex and TypeScript
Real and scalable applications with Nuxt, Vuex and TypeScriptReal and scalable applications with Nuxt, Vuex and TypeScript
Real and scalable applications with Nuxt, Vuex and TypeScript
 
Lord of the codes: Visual Studio y todo lo que puedes hacer con él
Lord of the codes: Visual Studio y todo lo que puedes hacer con élLord of the codes: Visual Studio y todo lo que puedes hacer con él
Lord of the codes: Visual Studio y todo lo que puedes hacer con él
 
Microsoft Student Partner
Microsoft Student PartnerMicrosoft Student Partner
Microsoft Student Partner
 
Reconnect
ReconnectReconnect
Reconnect
 
Cordova Productivity Tools
Cordova Productivity ToolsCordova Productivity Tools
Cordova Productivity Tools
 
Más productivos con Apache Cordova e Ionic
Más productivos con Apache Cordova e IonicMás productivos con Apache Cordova e Ionic
Más productivos con Apache Cordova e Ionic
 
Los bots son las nuevas apps
Los bots son las nuevas appsLos bots son las nuevas apps
Los bots son las nuevas apps
 
Gitflow Workflow
Gitflow WorkflowGitflow Workflow
Gitflow Workflow
 
Yo solo te pedí un plátano
Yo solo te pedí un plátanoYo solo te pedí un plátano
Yo solo te pedí un plátano
 
Mejora de la atención odontológica para países en desarrollo
Mejora de la atención odontológica para países en desarrolloMejora de la atención odontológica para países en desarrollo
Mejora de la atención odontológica para países en desarrollo
 
HTML5 en el universo Windows (Apps universales)
HTML5 en el universo Windows (Apps universales)HTML5 en el universo Windows (Apps universales)
HTML5 en el universo Windows (Apps universales)
 
Nos vamos de SPA
Nos vamos de SPANos vamos de SPA
Nos vamos de SPA
 
#Win8JSApps | 4.- Métodos de desarrollo
#Win8JSApps | 4.- Métodos de desarrollo#Win8JSApps | 4.- Métodos de desarrollo
#Win8JSApps | 4.- Métodos de desarrollo
 
Introduccion a la programacion (Pseudocódigo + JavaScript)
Introduccion a la programacion (Pseudocódigo + JavaScript)Introduccion a la programacion (Pseudocódigo + JavaScript)
Introduccion a la programacion (Pseudocódigo + JavaScript)
 
Pasado, presente y Futuro de las aplicaciones en HTML5
Pasado, presente y Futuro de las aplicaciones en HTML5Pasado, presente y Futuro de las aplicaciones en HTML5
Pasado, presente y Futuro de las aplicaciones en HTML5
 
Eventos en las páginas
 Eventos en las páginas Eventos en las páginas
Eventos en las páginas
 
Repaso conceptos básicos de JavaScript
Repaso conceptos básicos de JavaScriptRepaso conceptos básicos de JavaScript
Repaso conceptos básicos de JavaScript
 

Recently uploaded

VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college projectTonystark477637
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 

Recently uploaded (20)

VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 

YOU CAN INJECT DEPENDENCIES IN YOUR COMPONENTS, LET'S DO IT.

  • 1. There are two ways to explain a pattern…
  • 4. This strip was made by CKGrafico mixin some strips from, all the rights are for commitstrip, and their awesome work. Can you help me with a pattern? Ye s! And this is the new pattern to study this week FIRST YOU USE IT WITHOUT KNOWLEDGE
  • 5. This strip was made by CKGrafico mixin some strips from, all the rights are for commitstrip, and their awesome work. Can you help me with a pattern? Ye s! And this is the new pattern to study this week This strip was made by CKGrafico mixin some strips from, all the rights are for commitstrip, and their awesome work. Can you help me with a pattern? Ye s! And this is the new pattern to study this week AND YOU DISCOVER THE PATTERN
  • 6. This strip was made by CKGrafico mixin some strips from, all the rights are for commitstrip, and their awesome work. Can you help me with a pattern? Ye s! And this is the new pattern to study this week This strip was made by CKGrafico mixin some strips from, all the rights are for commitstrip, and their awesome work. Can you help me with a pattern? Ye s! And this is the new pattern to study this week YOU INVESTIGATE ALONE
  • 7. This strip was made by CKGrafico mixin some strips from, all the rights are for commitstrip, and their awesome work. Can you help me with a pattern? Ye s! And this is the new pattern to study this week This strip was made by CKGrafico mixin some strips from, all the rights are for commitstrip, and their awesome work. Can you help me with a pattern? Ye s! And this is the new pattern to study this week DISCUSS WITH TEAMMATES
  • 8. This strip was made by CKGrafico mixin some strips from, all the rights are for commitstrip, and their awesome work. Can you help me with a pattern? Ye s! And this is the new pattern to study this week This strip was made by CKGrafico mixin some strips from, all the rights are for commitstrip, and their awesome work. Can you help me with a pattern? Ye s! And this is the new pattern to study this week HAVE INTERNAL TRAININGS ABOUT IT
  • 9. AND YOU GO TO TALKS, HERE WE ARE!
  • 10. YOU CAN INJECT DEPENDENCIES IN YOUR COMPONENTS, LET'S DO IT! QuiqueFdezGuerra SoftwareEngineer PlainConcepts @CKGrafico
  • 11. WHY THIS PATTERN? A B - One of the most used patterns in backend for coupling. - If A depends on B and B is broken, you should change A. - A has to manage the life time of B. - Mocking dependencies is not easy. We want to make our classes independent from creating the instance of the dependencies.
  • 12. A THE SOLID PRINCIPLE A BIB Dependency Inversion Principle One module should not depend of other module, they both should depend of an abstraction
  • 13. Injector (container?) Inversion of Control ( IoC ) THE DESIGN PRINCIPLE A B A Creates B? B ☆ Using IoC, when one class depends on other class, the first should not manage the life time of the second, this should be done outside.
  • 14. THE (FAMOUS) PATTERN A Injector (container?) IB? B D C E Dependency Injection We should have one object supplies the dependency of another object helping on Inversion of Control, and we should use abstractions to apply Dependency Inversion.
  • 15. And how we work with that?
  • 16. WE HAVE A SERVICE
  • 17. AND WANT TO USE OTHER SERVICE
  • 18. How we usually import our dependencies?
  • 19. IMPORTING AN OBJECT ’’’’’Singleton’’’’’
  • 20. IMPORTING A CLASS ’’’’Transient’’’’’
  • 21. Congratulations! That was your first DI approach
  • 22. Object singleton, class transient, no container, the service has too much responsibility… abstractions?
  • 23. First step in the evolution chain, semi-injection
  • 26. 3rd STEP: INJECTION WITH CONTAINER
  • 28. 5th STEP: ADDING ABSTRACTIONS
  • 29. 6th STEP: MOVING TO COMPONENTS
  • 30. Ok, but how can I do that Quique?

Editor's Notes

  1. https://carbon.now.sh/?bg=rgba(21%2C23%2C25%2C1)&t=one-dark&wt=none&l=application%2Ftypescript&ds=true&dsyoff=19px&dsblur=25px&wc=true&wa=true&pv=80px&ph=68px&ln=true&fm=Hack&fs=15.5px&lh=144%25&si=false&es=4x&wm=false&code=import%2520%257B%2520insightsFactory%2520%257D%2520from%2520%27.%252Finsights%27%253B%250A%250Aclass%2520CartService%2520%257B%250A%2520%2520constructor(insights)%2520%257B%250A%2520%2520%2520%2520this.insights%2520%253D%2520insights%253B%250A%2520%2520%2520%2520this.products%2520%253D%2520%255B%255D%253B%250A%2520%2520%257D%250A%250A%2520%2520add(product)%2520%257B%250A%2520%2520%2520%2520this.products.push(product)%253B%250A%2520%2520%2520%2520this.insights.info(%2560Product%2520%2524%257Bproduct.id%257D%2520added%2520from%2520cart%2560)%253B%250A%2520%2520%257D%250A%257D%250A%250Aexport%2520const%2520cartService%2520%253D%2520new%2520CartService(insightsFactory())%253B