Category: Design Pattern
Dependency Inversion Principle
High level modules should not depend upon low level modules. Both should depend upon abstractions. Dependency inversion talks about the coupling between the different classes or modules. It focuses on the approach where the higher classes are not dependent on the lower classes instead depend upon the abstraction of the lower classes. The main motto…
Interface Segregation Principle(ISP)
Clients should not be forced to depend upon interfaces that they do not use. Do not force any client to implement an interface which is irrelevant to them You should prefer many client interfaces rather than one general interface and each interface should have a specific responsibility. Interface Segregation Principle is very much related to…
Liskov Substitution Principle
Subtypes must be substitutable for their base types without altering the correctness of the program Methods that use references to base classes must be able to use objects of derived classes without knowing it. If S is a subtype of T, then objects of type T in a program may be replaced with objects of type S without altering any of the…
Open-Closed Principle
Classes should be open for extension and closed to modification. Modification means changing the code of an existing class, and extension means adding new functionality. We should be able to add new functionality without touching the existing code for the class. This is because whenever we modify the existing code, we are taking the risk…
Single Responsibility Principle
A class should have only one reason to change. It means a class should have only one task to perform. This means that if a class is a data container, like a Book class or a Student class, and it has some fields regarding that entity, it should change only when we change the data…
SOLID Design Principles in C++
SOLID is an acronym for five design principles intended to make software designs more understandable, flexible, and maintainable. They are a subset of many principles promoted by Robert C. Martin. Though they apply to any object-oriented design, the SOLID principles can also form a core philosophy for agile development.Source : SOLID_Wikipedia SOLID acronyms are : SRP –…