The document discusses the Dependency Inversion Principle (DIP), which states that high-level modules should not depend on low-level modules, but that both should depend on abstractions. DIP is important for framework design, as it reduces tight coupling between modules. Violations of DIP include direct instantiation of concrete classes and use of static methods. The document provides examples of how to avoid DIP violations through dependency injection and inversion of dependencies on abstractions rather than concrete classes.
2. Dependency Inversion Principle
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
Maulik Soni
8. Demo
Demo of DIP and Dependency Injection using Unity
Maulik Soni
9. Summary
Depend on abstractions
No variable should hold a reference to a concrete class
No class should derive from a concrete class
No method should override an implemented method of any of its base classes
Heuristic is typically violated at least once
Somebody has to create the instances of the concrete classes
No reason to strictly follow this heuristic for classes that are concrete but non-volatile
Maulik Soni
10. End of Presentation
Maulik Soni
End of Introduction to SOLID Principles
S = Single Responsibility
O = Open / Closed
L = Liskov Substitution
I = Interface Segregation
D = Dependency Inversion
Editor's Notes
Framework – where making changes are easy, each piece is extensible, every dependency is replacible