Skip to content

Commit 3f6c39a

Browse files
committed
update Dependency Inversion Principle
1 parent 1771a88 commit 3f6c39a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -646,11 +646,10 @@ Resources
646646

647647
## Dependency Inversion Principle
648648

649-
Dependency Injection is an Inversion of Control technique for supplying objects (“dependencies”) to a class by a way of
650-
the Dependency Injection Design Pattern. Typically passing dependencies via constructor or field. In contrast the
651-
Dependency Inversion Principle is a general design guideline which recommends that classes should only have direct
652-
relationships with high-level abstractions. This means that classes should not depend on low-level details, emphasizing
653-
the use of interfaces and abstract classes.
649+
Dependency Inversion is the strategy of depending upon interfaces or abstract functions and classes rather than upon
650+
concrete functions and classes.
651+
Simply put, when components of our system have dependencies, we don’t want directly inject a component’s dependency into
652+
another. Instead, we should use a level of abstraction between them.
654653

655654
Why
656655

@@ -659,6 +658,7 @@ Why
659658
- Facilitates unit testing by allowing the use of mock objects, enabling isolated testing of modules.
660659
- Reduces the risk of breaking the system when changes are made.
661660
- Allows to add new implementations without changing the existing code, enhancing the system's extensibility.
661+
- Concrete classes change frequently, while abstractions and interfaces change much less.
662662

663663
How
664664

@@ -670,8 +670,8 @@ How
670670
Resources
671671

672672
- [SOLID — Dependency Inversion Principle](https://medium.com/@inzuael/solid-dependency-inversion-principle-part-5-f5bec43ab22e)
673-
- [Dependency Injection (wikipedia.org)](https://en.wikipedia.org/wiki/Dependency_injection)
674-
673+
- [DDependency inversion principle (wikipedia.org)](https://en.wikipedia.org/wiki/Dependency_inversion_principle)
674+
- [System Design: Dependency Inversion Principle](https://www.baeldung.com/cs/dip)
675675
## SOLID
676676

677677
A subset of programming principles:

0 commit comments

Comments
 (0)