## sketches

sketches for software development

An example of violation of Liskov Substitution Principle (LSP)

If Square inherits from Rectangle, the problem starts when the intention is to change the width. We expect the height of a rectangle remains the same. But that’s not the behavior of a Square.

It is a behavioral violation of LSP.

To fix it:

• Make Rectangle immutable or,
• Break the inheritance chain