Why is it called the dependency inversion principle
When should the dependency inversion principle NOT be used?
It seems to me that the original question lacks part of the DIP point.
The reason I am skeptical is that we pay a certain price for following this principle. Suppose I need to implement Feature Z. After analyzing it, I come to the conclusion that Feature Z is made up of functions A, B, and C. I create a Fascade class Z that uses classes A, B and C via interfaces and at some point I realize that task Z actually consists of functions A, B and D. Now I need to scrap the C interface, the prototype of the C class, and write a separate D interface and class. Without interfaces, only the Wave class would have to be replaced.
To really take advantage of the DIP, you must first create class Z and invoke the functionality of classes A, B, and C (which are not yet developed). This is how you get the API for classes A, B and C. Then you create classes A, B and C and fill in the details. You should effectively create the abstractions you need when building Class Z based on the needs of Class Z. You can even write tests around Class Z before Class A, B, or C are even written.
Remember, the DIP states that "high-level modules should not depend on low-level modules. Both should depend on abstractions."
Once you've figured out which Class Z needs and how it would like to get what it needs, you can enter the details. Sure, sometimes changes need to be made to Class Z, but 99% of the time it doesn't.
There will never be a class D because you figured out that Z needed A, B, and C before they were written. A change in requirements is a whole different story.
- How is Ultron related to Thanos?
- Is the Bank of Baroda reliable
- What Makes Psychopaths Smart
- What are the benefits of volatility
- How do poets generally use allusions?
- The laws of science can be changed
- Are Wildcraft backpacks worth buying?
- What does a ball mean
- What does chronic pain mean?
- Do we need IELTS for students VISA
- Which means less of a person
- Does your company have a Facebook site?
- ATF agents are police officers
- We command loyalty from good leaders
- Why is Shivsena so popular in Maharashtra
- How do you recognize anions and cations
- Do you practice charity for strangers
- When was pro wrestling first on TV?
- When will Google Pixel 3a launch
- Why is 2019 the year of podcasts
- What's your worst humiliating wedding experience
- What do people prefer hearts or thoughts
- How did Rutherford split the atom?
- Are public universities better than private universities?