Skip to content
This repository has been archived by the owner on Aug 23, 2024. It is now read-only.

Commit

Permalink
Update DIP.md
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoborbadev authored Feb 19, 2024
1 parent 45fe523 commit 55649fc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Concepts/SOLID/DIP.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,9 @@ public class ClassA {

Now, `ClassA` is not directly dependent on `ClassB`, but rather on `InterfaceB`, the same goes for `ClassB`. This is the essence of *DIP*.

See the [*source code here*](https://github.com/diegoborbadev/solid-principles-java/tree/main/src/main/java/DIP).
See the [*source code here*](https://github.com/diegoborbadev/solid-principles-java/tree/main/src/main/java/DIP).

## Why is the DIP important?
When developing code for applications, it is common to organize our logic into multiple modules. However, this can lead to a codebase with dependencies. One of the motivations behind the *Dependency Inversion Principle* is to **prevent us from depending upon modules that often change**. Concrete classes often experience frequent modifications, whereas abstractions and interfaces are subject to less frequent changes. This approach simplifies tasks like bug fixing, code recompiling, or merging different branches.

Nevertheless, the significance of *DIP* extends beyond this. It plays a pivotal role in achieving loosely coupled and maintainable systems, complementing concepts such as Polymorphism and Dependency Injection

0 comments on commit 55649fc

Please sign in to comment.