# Dependency Inversion Principle

Record: `arch:dependency-inversion`
Kind: principle
Layer: [Structural Core](https://banes-lab.com/records/layer/structural-core.md)
Severity: mandatory
Scope: module, component, layer
Aliases: DIP
Canonical: https://banes-lab.com/ontology#arch-dependency-inversion

## Repair

- Refactored by: Extract Interface, Introduce Port, Inject Dependency
- Detected by: dependency direction violations
- Violated by: domain importing infrastructure
- Measured by: inward dependency ratio
- Enforced by: dependency graph rules, architecture tests

## requires

- [Abstraction](https://banes-lab.com/records/arch/abstraction.md)
- [Stable Interfaces](https://banes-lab.com/records/arch/stable-interfaces.md)

## reinforces

- [Low Coupling](https://banes-lab.com/records/arch/low-coupling.md)
- [Clean Architecture](https://banes-lab.com/records/arch/clean-architecture.md)

## enables

- [Dependency Injection](https://banes-lab.com/records/arch/dependency-injection.md)
- [Ports and Adapters](https://banes-lab.com/records/lex/ports-and-adapters.md)

## conflicts-with

- [Concrete Dependency](https://banes-lab.com/records/lex/concrete-dependency.md)

## tensions-with

- [Runtime Indirection](https://banes-lab.com/records/lex/runtime-indirection.md)

## tensions

- [Dependency Inversion Principle (DIP) Runtime Indirection](https://banes-lab.com/records/tension/dependency-inversion-principle-dip-runtime-indirection.md)

## referenced-by

- [Ports and Adapters Architecture](https://banes-lab.com/records/arch/ports-and-adapters-architecture.md)
- [Clean Architecture](https://banes-lab.com/records/arch/clean-architecture.md)
- [Interface-Based Design](https://banes-lab.com/records/arch/interface-based-design.md)
- [Abstraction](https://banes-lab.com/records/arch/abstraction.md)
- [Replaceability](https://banes-lab.com/records/arch/replaceability.md)
- [Testability](https://banes-lab.com/records/arch/testability.md)
- [Inversion of Control (IoC)](https://banes-lab.com/records/arch/inversion-of-control.md)
- [Dependency Injection](https://banes-lab.com/records/arch/dependency-injection.md)
- [Service Locator Pattern](https://banes-lab.com/records/arch/service-locator-pattern.md)

## Evidence in the code

- [importsDiagram](https://banes-lab.com/source/tree/domain/converters/graph.converter.ts.md)
- [core](https://banes-lab.com/anatomy/tree/folder-core.md)
- [domain](https://banes-lab.com/anatomy/tree/folder-domain.md)
