Arkitektura & Design Patterns

DI containers & composition root

Në shqip: Kontejnerët e injektimit të varësive

ShpjegimiSQ

Një kontejner DI (Spring, .NET, NestJS, InversifyJS) krijon objektet dhe u jep varësitë automatikisht. „Composition root“ është vendi i vetëm ku lidhet gjithçka. „Service locator“ (të marrësh varësitë nga një regjistër global) konsiderohet anti-model.

EnglishEN

A DI container (Spring, .NET, NestJS, InversifyJS) creates objects and supplies their dependencies automatically. The “composition root” is the single place where everything is wired. A “service locator” (pulling dependencies from a global registry) is considered an anti-pattern.

Si ta mendosh

Si një menaxher që u jep çdo punëtori veglat e duhura në fillim të ditës.

Lexoje në anglisht

Like a foreman handing each worker the right tools at the start of the day.

Terma të lidhur