

In other words, every switch should carry out a single responsibility. These two responsibilities are of different nature and evidently need to be carried out separately.Thus, the obvious solution to this problem is to assign different switches to both the responsibilities. In addition to this, it used to switch on the AC. As a result, the same switch is being used when you want to use an electric appliance plugged in the socket. Here we can see that a single switch is assigned two responsibilities. Even if you don’t need the air conditioner, it is still switched on. When you want to use the socket for plugging in an appliance, you unintentionally turn on the air conditioner as well.


The electrician has assigned a single switch to a three-pin plug socket as well as to the power supply of an air conditioner in your bedroom. Use Case Faulty Electrical Circuit DesignĬonsider a real-life situation of a faulty electrical circuit design in your house. This helps us in saving our time when we want to make changes in a particular class without impacting the other responsibilities. Furthermore, we decide the responsibilities of these classes and also make sure that responsibilities of a single area are clubbed together in one class. The classes of a project are created by keeping in mind the various requirements of the project. If you haven’t checked out the post related to SOLID Principles, I suggest you to do that before going any further to get a better grasp of the big picture. The Single Responsibility Principle is the first principle mentioned in the acronym SOLID. In the end, there is going to be a Conclusion section. Afterwards, there is going to be an Explanation section which would explain the program. Moving along, there is going to be an Example section which contains the use of Single Responsibility Principle in a program. Secondly, there is a Use Casesection that would explain the concept of Single Responsibility. In this post there is going to be an Introduction to the Single Responsibility Principle. Hello everyone! Welcome back again to our blog Simply Engineers! In this post, we will try to go through the Single Responsibility Principle.
