O B J E C T O R I E N T E D P R O G R A M M I N G
SOLID PRINCIPLES
INTRODUCTION
o Five principles of Object-Oriented class design.
o All serves the same purpose which is “to create
understandable, readable and testable code that many
developers can collaboratively work on.”
Single
Responsibility
Principle
Open-closed
Principle
Liskov
Substitution
Principle
Interface
Segregation
Principle
Dependency
Inversion
Principle
SINGLE RESPONSIBILITY
PRINCIPLE
“A class must perform a single responsibility and thus should only have a single
reason to change.”
OPEN- CLOSED PRINCIPLE
The classes should be open for extension and closed for modification.
LISKOV SUBSTITUTION
PRINCIPLE
Subclasses should be substitutable for their base classes.
Base class
INTERFACE SEGREGATION
PRINCIPLE
Separating the
interfaces in a way
that the certain
function of an
interface which is not
applicable on a class
should not be used
accordingly.
DEPENDENCY INVERSION
PRINCIPLE
High-level modules should not depend on low level modules. Instead, both should depend on
abstraction.
THANK YOU

#4 | Object Oriented Programming's SOLID Principles | Sameer Siddiqui