Friday, 6 July 2012

What is the Single Responsibility Principle?

A class should have only one reason to change.

This principle implies that if we have more than one reason to change a class, then the class is probably too cluttered and it would be beneficial to split the functionality into two classes where each class will handle one responsibility. This means that in future if change is needed then we will only need to modify one which should improve maintainability and decouples implementations too so that they don’t have impact on one another.

No comments:

Post a Comment