single-responsibility-principle

Single Responsibility Principle in Clean Architecture, Aggregating UseCases in one UseCaseManager which can provide UseCase based on In & Out Object.

╄→尐↘猪︶ㄣ 提交于 2019-11-28 08:49:22
问题 I want to implement Single Responsibility principle in my projects Domain layer (Clean MVVM). I've approx. 200 different use-cases which are being very hectic to manage. Now I'm thinking to create one UseCaseManager which can provide me required UseCase based on Input & Output Object. I've tried an approach but that's not looking very good.I'm mentioning some sample code, Please help me how can I aggregate all the UseCases to one UseCaseManager. UseCase1: public class ActualUseCase1 extends

How to hide logic behind a class to improve readability of method and refactor class to follow SRP?

狂风中的少年 提交于 2019-11-28 03:18:50
问题 I have an algorithm to create a version for an entity and then I save that version against below 2 entity: 1) Variant 2) Category interface IEntityVersion { string GetVersion(); } public class EntityVersion : IEntityVersion { public string GetVersion() { return null; } } public interface IVariant { void Process(Variant model, string connectionString); } public abstract class BaseVariant : IVariant { private readonly IEntityVersion _entityVersion = new EntityVersion(); public void Process

Difference between Single Responsibility Principle and Separation of Concerns

会有一股神秘感。 提交于 2019-11-27 09:49:14
问题 What is the difference between Single Responsibility Principle and Separation of Concerns? 回答1: Single Responsibility Principle (SRP)- give each class just one reason to change; and “Reason to change” == “responsibility”. In example: Invoice class does not have a responsibility to print itself. Separation of Concerns (since 1974). Concern == feature of system. Taking care of each of the concerns: for each one concern, other concerns are irrelevant. Hiding implementation of behavior. From here

Learning Single Responsibility Principle with C#

丶灬走出姿态 提交于 2019-11-27 06:11:17
I am trying to learn the Single Responsibility Principle (SRP) but it is being quite difficult as I am having a huge difficult to figure out when and what I should remove from one class and where I should put/organize it. I was googling around for some materials and code examples, but most materials I found, instead of making it easier to understand, made it hard to understand. For example if I have a list of Users and from that List I have a class Called Control that does lots of things like Send a greeting and goodbye message when a user comes in/out, verify weather the user should be able

What is an example of the Single Responsibility Principle? [closed]

谁都会走 提交于 2019-11-27 01:18:44
Can someone give me an example of the Single Responsibility Principle? I am trying to understand what it means, in practice, for a class to have a single responsibility as I fear I probably break this rule daily. Check out the Solid description . Unless you ask for something more specific, it will be hard to help more. Single responsibility is the concept of a Class doing one specific thing (responsibility) and not trying to do more than it should, which is also referred to as High Cohesion. Classes dont often start out with Low Cohesion, but typically after several releases and different

Does the Single Responsibility Principle work in OOP?

心已入冬 提交于 2019-11-26 21:21:18
问题 I am struggling to understand how the Single Responsibility Principle can me made to work with OOP. If we are to follow the principle to a tee, then are we not left with many classes, many of which may just have one method each? If we don't follow the principle exactly, then what is the point in the principle? 回答1: I like to state the single responsibility principle this way: "Every thing you write -- every module, class, interface, or method, should have one job. It should do the whole job

Learning Single Responsibility Principle with C#

守給你的承諾、 提交于 2019-11-26 10:14:28
问题 I am trying to learn the Single Responsibility Principle (SRP) but it is being quite difficult as I am having a huge difficult to figure out when and what I should remove from one class and where I should put/organize it. I was googling around for some materials and code examples, but most materials I found, instead of making it easier to understand, made it hard to understand. For example if I have a list of Users and from that List I have a class Called Control that does lots of things like

What is an example of the Single Responsibility Principle? [closed]

纵然是瞬间 提交于 2019-11-26 09:34:56
问题 Can someone give me an example of the Single Responsibility Principle? I am trying to understand what it means, in practice, for a class to have a single responsibility as I fear I probably break this rule daily. 回答1: Check out the Solid description. Unless you ask for something more specific, it will be hard to help more. Single responsibility is the concept of a Class doing one specific thing (responsibility) and not trying to do more than it should, which is also referred to as High