Glib
@sushev
5. D - Dependency Inversion Principle (DIP) “Depend on abstractions, not on concretions.” DIP advocates that high-level modules should not depend on low-level modules; both should depend on abstractions (e.g., interfaces). This principle reduces the coupling between classes, making the system more modular and easier to modify or test by simply substituting dependencies without changing the core logic. Example: In a logging system, rather than depending directly on a FileLogger class, create an interface Logger with a method logMessage(). The main application only interacts with Logger, allowing you to swap out FileLogger, DatabaseLogger, or any other logger implementation as needed without changing the application code.
0 reply
0 recast
0 reaction