How to determine if class meets single responsibility principle ?

Posted by user1483278 on Programmers See other posts from Programmers or by user1483278
Published on 2012-06-28T18:20:45Z Indexed on 2012/06/28 21:24 UTC
Read the original article Hit count: 210

Single Responsibility Principle is based on high cohesion principle. The difference between the two is that highly cohesive classes feature a set of responsibilities that are strongly related, while classes adhering to SRP have just one responsibility.

But how do we determine whether particular class features a set of responsibilities and is thus just highly cohesive, or whether it has only one responsibility and is thus adhering to SRP? Namely, isn't it more or less subjective, since some may find class very granular ( and as such will consider a class as adhering to SRP ), while others may find it not granular enough?

© Programmers or respective owner

Related posts about design-patterns

Related posts about single-responsibility