SOLID - by Rom OD
SOLID - by Rom OD
Machine Brew
coffee
updating
CoffeMachine
:CoffeeMachine
PremiumCoffeeMachine
2 - Implement components
3 - Composing
Interface Segregation Principle
Analogy
interface ICoffee {
GrindCoffeeBeans();
BoilWater();
PourCoffee();
AddCream();
}
@romain-od
How it’s works
@romain-od
Abstraction
@romain-od
Low-Level
@romain-od
High-Level
@romain-od
Dependence
Registration
OR
OR
@romain-od
Singleton
A single instance of the dependency is created
and shared across the entire application.
Life of coffeemachine
@romain-od
Scoped
A new instance of the dependency is created
once per scope. A scope can be thought of as a
unit of work.
@romain-od
Transient
A new instance of the dependency is created
each time it is requested
@romain-od
What about reference ?
@romain-od
Captive Dependency
Captive Dependency is a dependency with an
incorrectly configured lifetime. A service
should never depend on a service that has a
shorter lifetime than its own.
Transient
Scoped
Singleton
@romain-od
Can we use a different provider to fill the
Water Tank and rinse the filter ?
@romain-od
Keyed services
@romain-od
Thanks for reading