Solid Principle in Simple Way (stackoverflow.blog)


Published:   November 2, 2021

Tags:
Bookmark for: https://stackoverflow.blog/2021/11/01/why-solid-principles-are-still-the-foundation-for-modern-software-architecture/

Summary:

Single Responsibility principle :

Don’t surprise the people who read your code.

There should never be more than one reason for a class to change. You should be able to use and add to a module without rewriting it.

Open-Close principle

Don’t surprise the people who use your code. Your code should be close for modification and open for extension

Liskov substitution principle

Don’t overwhelm the people who read your code. If S is a subtype of T, then objects of type T may be replaced with objects of type S without altering any of the desirable properties of the program. You should be able to substitute one thing for another if those things are declared to behave the same way.

Interface segregation principle: Use sane boundaries for your code.

Many client-specific interfaces are better than one general-purpose interface. Don’t show your clients more than they need to see

Dependency inversion principle: Use the right level of coupling—keep things together that belong together, and keep them apart if they belong apart.

Depend upon abstractions, not concretions.



< Prev   Further Reading   Next >

For feedback mail me at: email@murarisumit.in