Liskov Substitution Princple Common Smells
- Method throws [[NotSupportedException]]
- Empty or [[degenerative implementation]]
- [[Downcast]]s
TipsΒΆ
-
Liskov Substitution Principle is often the result of Open-Closed Principle and Interface Segregation Principle violations
-
If two [[class]]es share some logic and they are not substitutable
- Create new [[base class]]
- Inherit those two classes from a base class
- Ensure that they are substitutable with the new base class