Linked Questions

0
votes
1answer
188 views

Granularity of the Single Responsibility Principle [duplicate]

This is a related question and the OP appeared to go with extreme levels of granularity. The answers gave a good overview but I gather it's still somewhat down to personal interpretations/situations ...
0
votes
0answers
127 views

Understanding Single Responsibility Pattern (SRP) [duplicate]

According to the Single Responsibility Pattern (SRP) a method or class should have one responsibility. I have read a couple of sources and viewed some videos and I would like to understand it by ...
76
votes
8answers
13k views

How can a class have multiple methods without breaking the single responsibility principle

The Single responsibility principle is defined on wikipedia as The single responsibility principle is a computer programming principle that states that every module, class, or function should have ...
50
votes
7answers
12k views

Managing and organizing the massively increased number of classes after switching to SOLID?

Over the last few years, we have been slowly making the switch over to progressively better written code, a few baby steps at a time. We are finally starting to make the switch over to something that ...
12
votes
6answers
4k views

What are the practical ways to implement the SRP?

Simply what are the practical techniques people use to check if a class violates the single responsibility principle? I know that a class should have only one reason to change, but that sentence is ...
9
votes
8answers
2k views

Single Responsibility Principle Violation?

I recently got into a debate with another developer regarding the below class: public class GroupBillingPayment { public void Save(IGroupBillingPayment model) { if (model == null || ...
4
votes
3answers
815 views

How to apply the single responsibility principle if the program should do a lot of things?

If I need to write a program that Reads a json file Converts its data to yaml Writes it to yaml file and adhering to the single responsibility principle I create classes like FileReader ...
5
votes
1answer
753 views

Which design is better for this problem?

I have a problem and I want to know what is the best way to solve it. Problem: I have a Binary Decision Tree. Each leaf node has an object (called Matrix) that stores some information and performs ...
5
votes
4answers
370 views

Should data sanity checks be separated from methods that insert the data?

I have a simple example of two setups of the same block of code, but i am not sure what would be considered the "better" option, although subjective, i read about methods often doing too much than ...
2
votes
3answers
104 views

Finding object responsibilities while designing a book reader

The biggest difficulty I am having is finding responsibilities of each object identified by me in the system or so called problem space. I am positing a very simplified description of a book reader. ...
0
votes
2answers
77 views

Why doing more than one thing in a class is sometimes valid? [duplicate]

classes and method should do one thing like the code below: class A { public int a() { b(); } private int b() { c(); } private int c() { } } The code mentioned below I found it ...