So … what is SOLID?Five basic principles of object-orientedprogramming and design.Single responsibility principleOpen/closed principleLiskov substitution principleInterface segregation principleDependency inversion principle
Who put them together?What do you know … its Uncle Bob!Robert C. Martin http://objectmentor.com/omTeam/martin_r.html
OCPSoftware entities (classes, modules,functions, etc.) should be open for extension,but closed for modification. WikipediaOpen and closed … another paradox!?New functionality can be added as newrequirements are generated.Never modify the code except to correct bugs.
LSPIf S is a subtype of T, then objects of type Tmay be replaced with objects of type Swithout altering any of the desirableproperties of that program (correctness, taskperformed, etc.) WikipediaThat sounds so ... formal!Code that uses a base class must be able tosubstitute it with a subclass without knowingit.