S.O.L.I.D. Class Design Principles
Abbreviation Full Form Definition Reason S Single Responsibility Principle A class should have only one reason to change i.e. should have only one purpose to serve. - loosely coupled - less change lead to less break down of application - helps to change identity of object without affecting other modules O Open-Closed Principle A class should be open for extension closed for modification. - Anyone need to make change in your class has to inherit the class and change. This allows the existing functionality to stay intact. L Liskov Substitution Principle Derived types should always be substitutable by its parent class (base type). Derived types should be compatible with its base type. For e.g.: Square is a Rectangle i.e. Square represents a Rectangle. In case, if we try to set dimension of a Rectangle reference pointing to Square instance, the flow will be weird as it will always override the dimension of rectangle. I Interface Seg...
Comments
Post a Comment