SOLID Design Principles Overview

DENNIS ILUMA
1 min readJun 24, 2021

--

1. S => Single Responsibility. This states that every class or module should have a single responsibility. That means a class should not be made to perform more that one specific operation. E.g A data class should only be made to hold data. A situation where by a data class is both holding data and performing calculations is breaking this rule.

2. O=> Open-Closed. This implies that a class should be open for extention and closed for modification as much as possible.

3.L => Liskov Principle. It states that a child class should not alter the functionality of her parent class. This means that whenever a child class is using a method from a parent class it should try as much as possible not to change the original fuctionality .

4. I => Interface Segregation. It means a class should not be force to implement methods it doesn’t need. Instead the interface should be broken down to smaller interfaces in order to reduce the unused-interface the class is using.

5. D => Dependency Inversion. It implies a High level module shouldn’t depend on a lower one i.e A parent class should not depend on her child. Instead, a child class should depend on its parent. Secondly, If there is a component/ method common to both classes, the component should be abstracted.

--

--

DENNIS ILUMA
DENNIS ILUMA

Written by DENNIS ILUMA

0 Followers

Software engineer. Majors in Java, AI, Frontend, DevOps & Cloud.

No responses yet