SOLID Design Principles
Liskov Substitution Principle
Iff S is a Subtype of T, then objects of type T may be replaced with objects of type S. This means, Derived types must be completely substitutable for their base types. It is basically extension of Open Closed Principle.
Implementation guidelines
1. No new exceptions can be thrown by the subtype unless they are part of the existing exception hierarchy.
2. Clients should not know which specific subtype they are calling
3. New derived classes just extend without replacing the functionality of old classes
Solution:
Liskov Substitution Principle
Iff S is a Subtype of T, then objects of type T may be replaced with objects of type S. This means, Derived types must be completely substitutable for their base types. It is basically extension of Open Closed Principle.
Implementation guidelines
1. No new exceptions can be thrown by the subtype unless they are part of the existing exception hierarchy.
2. Clients should not know which specific subtype they are calling
3. New derived classes just extend without replacing the functionality of old classes
Solution:
No comments:
Post a Comment