S.O.L.I.D Principles

Janaka Chinthana Dissanayake
2 min readApr 11, 2021

Mainly there are 5 principles that can be seen in object-oriented programing that should be followed when designing software.

S => Single responsibility.

O => Open-Close.

L => Liskov substitution.

I => Interface segregation.

D => Dependency inversion.

S.O.L.I.D Principles

Single Responsibility Principle

“A class should have one and only one reason to change, meaning that a class should have only one job”

ex: If having a class to calculate the area of a rectangle, it should not be included method like calculate the area of a circle. A class should be responsible for one particular job.

Open-Close Principle

“Object or entities should be open for extension, but closed for modification”

Liskov Substitution Principle

“Every subclass/derived class should be able to substitute their parent/base class”

ex: When a class needs to extend a base class it should perform the basic functionalities of the base class.

Interface Segregation Principle

“Client should not be forced to implement methods they do not use”

Dependency Inversion Principle

“Higher-level modules should not depend on lower-level modules, but they should depend on abstraction”

--

--

Janaka Chinthana Dissanayake
0 Followers

I am an undergraduate student of SLIIT following BSc.(HonS ) in IT specialization in Software Engineering