SOLID-Dependency Inversion Principle

Details
Full Name

SOLID Dependency Inversion Principle (DIP)

Intent:

High-level modules should not depend on low-level modules. Both should depend on abstractions. Abstractions should not depend on details; details should depend on abstractions.

When to Use:

  • High-level business logic directly instantiates infrastructure classes

  • Changing a database or framework requires modifying business logic

  • Unit testing requires running actual external services

Prompt Example:

"Refactore diese Klasse nach dem SOLID-Dependency Inversion Principle, sodass die Abhängigkeiten über Interfaces injiziert werden."