Object-Oriented Design – Is SRP (Single Responsibility Principle) Objective?

object-orientedobject-oriented-designoodasingle-responsibility

Consider two UI designers who want to design "user attractive" designs. "User attraction" is a concept that is not objective and only resides in the mind of designers. Thus designer A could for example pick up red color, while designer B picks blue. Designer A create a layout which is entirely different from designer B, and so on.

I read about SRP (Single Responsibility Principle) and what I understood was kind of a subjective analysis or break down of responsibilities that can vary from an OO designer to another OO designer. Am I right? In other words, is it possible to have two excellent object oriented analyzer and designer who come up with two different designs for one system based on SRP principal?

Best Answer

A good question and one I used to often mull over.

I would say not objective, no. Definitely subjective. How you approach breaking down problems depends on your philosophy toward that type of problem. Science shows us that there can be many different ways to solve the same problem effectively. Science also shows us that people continents apart can come up with the same solutions independently, and so some solutions are more obvious than others. In any case, judging solutions in terms of "best" depends on your criteria.

Really, what one might see as two parts of the same whole, another might see as two totally separate concepts. One sees this all the time when looking at how maintainers of different code libraries approach the same problem. And yet both solutions work just fine.

(PS. Edited this answer as the OP's final question asks the opposite of the question title.)

Related Topic