Single Responsibility Principle — S of SOLID

Ashan Priyadarshana
2 min readAug 6, 2021

The Single Responsibility principle states that any software entity (class, method) should have only one responsibility assigned to it. If you are in any doubt on whether should you change a class or a method code, the only thing you need to do is ask the following two questions and if the answer is yes, then you need to change that particular class code/method code.

Bulbs are meant to give light only — photo by Rodolfo Clix
  1. Does the class or…

--

--

Ashan Priyadarshana

Associate Technical Lead | BSc. Information Technology | MSc. Artificial Intelligence | Founder Programming.lk | GSoC 2017 |