Liskov Substitution Principle and legacy code

How do you determine whether a change should affect the entire application or just a slice? One way is to employ the LSP. Simply put, LSP says that a class should do what it sounds like it does. Any behavior change that would change that should be a different dependency.

That is, any change that changes behavior should probably be a new method or a new class with the appropriate method in it. This will prevent accidental side effects in the rest of the application and keep your code cleaner.

Get Improving your C# Skills now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.