SOLID is a mnemonic acronym introduced by Michael Feathers for five of the principles named by Robert C. Martin, and when applied together, these intend to make it more likely that a programmer will create a system that is easy to maintain and extend over time.
-
(++) Single responsibility principle (SRP)
-
Every class should have a single responsibility, and that responsibility should be entirely encapsulated by the class. All its services should be narrowly aligned with that responsibility.
-
-
Open Close Principle (OCP)
-
Open for extension, closed for modification. Our code should be open to change (or extension) and closed for modification to accommodate that change.
-
-
(++) Liskov substitution principle
-
Objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program.
-
-
Interface segregation principle
-
Many client-specific interfaces are better than one general-purpose interface.
-
-
Dependency inversion principle (DIP)
-
Depend upon abstractions. Do not depend upon concretions. Spring's frameworks popular dependency injection feature is based on this principle.
-
References:
- https://en.wikipedia.org/wiki/SOLID_(object-oriented_design)
- Head First Design Patterns By Eric Freeman, Elisabeth Freeman, Bert Bates, Kathy Sierra
- heartin's blog
- Log in or register to post comments
Recent comments