You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cohesion:- Higher cohesion helps better adherence to the SRP
Coupling:- It is defined as the level of inter dependency between the software components. Loose coupling helps better adherence to SRP.
Every software component should have one and only one reason to change. Otherwise, more changes will lead to more bugs which also lead to more testing
Code
Low cohesion functions calculateArea/calculatePerimeter and draw/rotate are belonged to same type i.e. Square Code-not-following-SRP
Now the overall cohesion increase as we separate out the functions Code-following-SRP
Tight coupling between the Student and DB. So in future if we want change the DB then it will lead to change in Student functionality. Code-not-following-SRP
Loose coupling between the Student and DB. So in future if we want to change the DB then it will not lead to change in Student functionality. Code-following-SRP