Relative Content

Tag Archive for single-responsibility

OO – are large classes acceptable? [duplicate]

This question already has answers here: How would you know if you’ve written readable and easily maintainable code? [closed] (19 answers) Closed 11 years ago. Despite many years in IT, I still struggle with OO design. One particular problem I seem to keep ending up with is large classes, often containing many hundreds of lines […]

should I create a new class for a specific piece of business logic?

I have a Request class based on the same Entity in my Domain. It currently only has property definitions. I’d like to add a method for checking a duplicate Request which I’ll call from my controller. Should I add a method called CheckDuplicate in the Request class? Would I be violating the SRP? The method will need to access a database context to check already existing requests. I’m thinking creating another class altogether for this logic that accepts a datacontext as part of its constructor. But creating a whole new class for just one method seems like a waste too. Any advice?

should I create a new class for a specific piece of business logic?

I have a Request class based on the same Entity in my Domain. It currently only has property definitions. I’d like to add a method for checking a duplicate Request which I’ll call from my controller. Should I add a method called CheckDuplicate in the Request class? Would I be violating the SRP? The method will need to access a database context to check already existing requests. I’m thinking creating another class altogether for this logic that accepts a datacontext as part of its constructor. But creating a whole new class for just one method seems like a waste too. Any advice?

should I create a new class for a specific piece of business logic?

I have a Request class based on the same Entity in my Domain. It currently only has property definitions. I’d like to add a method for checking a duplicate Request which I’ll call from my controller. Should I add a method called CheckDuplicate in the Request class? Would I be violating the SRP? The method will need to access a database context to check already existing requests. I’m thinking creating another class altogether for this logic that accepts a datacontext as part of its constructor. But creating a whole new class for just one method seems like a waste too. Any advice?

Single responsibility vs procedural programming [duplicate]

This question already has answers here: Clarify the Single Responsibility Principle (14 answers) Closed 9 years ago. Single responsibility (from SOLID) is like making me create classes with only one public method. But if it’s so, it would be possible use static methods, and go back to procedural programming. What’s the difference? object-oriented solid single-responsibility […]

Single responsibility vs procedural programming [duplicate]

This question already has answers here: Clarify the Single Responsibility Principle (14 answers) Closed 9 years ago. Single responsibility (from SOLID) is like making me create classes with only one public method. But if it’s so, it would be possible use static methods, and go back to procedural programming. What’s the difference? object-oriented solid single-responsibility […]

Single responsibility vs procedural programming [duplicate]

This question already has answers here: Clarify the Single Responsibility Principle (14 answers) Closed 9 years ago. Single responsibility (from SOLID) is like making me create classes with only one public method. But if it’s so, it would be possible use static methods, and go back to procedural programming. What’s the difference? object-oriented solid single-responsibility […]

Achieving multiple tasks within one loop

With relation to what’s considered good OOP engineering principles, SOLID, DRY, KISS etc
I am wondering whether to complete multiple tasks within one loop when easily done.

Achieving multiple tasks within one loop

With relation to what’s considered good OOP engineering principles, SOLID, DRY, KISS etc
I am wondering whether to complete multiple tasks within one loop when easily done.

Achieving multiple tasks within one loop

With relation to what’s considered good OOP engineering principles, SOLID, DRY, KISS etc
I am wondering whether to complete multiple tasks within one loop when easily done.