Understanding SOLID Principles in Software Development
Samples in C#
Below are the simple way to understand Solid Principles
Single Responsibility Principle
Don’t write super classes. Keep them as small as possible to complete a unit of work.A dog model should contain only relevant information for dog.
A dog history model should contain the history for the dog model.
A kennel model should only have the information about the kennel, then the dog may have a field that references the kennel Id.
Open close principle.
Create and destroy of a class is critical for healthy memory management. You can look at IDisposable.Liskov Substitution Principle
Simply put, define your interfaces with Interface classes, Abstract classes, etc. Using IDisposable is a good example of properly using Liskov Substitution Principle."You should be able to use any derived class instead of a parent class and have it behave in the same manner without modification."
Interface Segregation Principle
See Liskov above as foundation but keep your interfaces as tight as possible. Remember, once interface can inherit another. You then can implement multiple interfaces in your class as needed.Dependency Inversion Principle
Seach IoC/DI for the best example of practical Dependency Inversion. You are basically injecting an external dependency into your code for it to work. Look at this as adding your engine to your car every time you go drive; removing it when you are done. Just more practical.

