You should provide Benz instance in order for CarUtil’s drive() method to function. Before refactoring, ProductCatalog was dependent on SQLProductRepository.

4m read timeFrom medium.com
Post cover image
Table of contents
Dependency Inversion Principle: How Google Developers write codeWhat is Dependency Inversion Principle?Can you see what’s wrong with this code?What is Abstraction?Refactoring Previous Code with AbstractionWhat you have achieved nowOne strep forward, Dependency InjectionConclusionOther Articles for Solid Principles
2 Comments

Sort: