The single-responsibility tag has no wiki summary.
3
votes
2answers
235 views
Questions about identifying the components in MVC
I'm currently developing an client-server application in node.js, Express, mustache and MySQL. However, I believe this question should be mostly language and framework agnostic.
This is the first ...
-1
votes
1answer
186 views
Low Coupling: Single Responsibility Principle vs Cohesion
I've read several articles on SRP and cohesion, and they seem to contradict each other as far as low coupling is concerned.
Articles on cohesion argue that putting closely related responsibilities ...
8
votes
2answers
324 views
Is there an “ask for only what you need” interface principle?
I have grown into using a principle for designing and consuming interfaces that says basically, "ask for only what you need."
For instance, if I have a bunch of types that can be deleted, I'll make ...
11
votes
6answers
373 views
Does multiple inheritance violate Single Responsibility Principle?
If you have a class which inherits from two distinct classes, does not this mean that your subclass automatically does (at least) 2 things, one from each superclass?
I believe there is no difference ...
5
votes
3answers
270 views
What is the difference between Single Responsibility Principle and Separation of Concerns
a)What is the difference between SRP and SoC? Perhaps that SRP is applied at class level, while SoC can be applied at system, subsystem, module, class or function levels.
b) If answer to a) is yes, ...
1
vote
1answer
108 views
Something confusing about Single Responsibility Principle
1)
In fact if two responsibilities are always expected to change at the
same time you arguably should not separate them into different classes
as this would lead, to quote Martin, to a "smell ...
5
votes
4answers
272 views
How to determine if class meets single responsibility principle ?
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 ...
3
votes
2answers
171 views
Should these concerns be separated into separate objects?
I have objects which implement the interface BroadcastInterface, which represents a message that is to be broadcast to all users of a particular group. It has a setter and getter method for the ...
9
votes
6answers
530 views
Struggling with the Single Responsibility Principle
Consider this example:
I have a website. It allows users to make posts (can be anything) and add tags that describe the post. In the code, I have two classes that represent the post and tags. Lets ...
20
votes
12answers
1k views
When does the “Do One Thing” paradigm become harmful?
For the sake of argument here's a sample function that prints contents of a given file line-by-line.
Version 1:
void printFile(const string & filePath) {
fstream file(filePath, ios::in);
...