hiltdial.blogg.se

Violation of single responsibility principle
Violation of single responsibility principle















Maintains a manageable project: Related to the previous advantage.

VIOLATION OF SINGLE RESPONSIBILITY PRINCIPLE CODE

This makes it easier to understand what does what and the complexity of the code would be reduced. Improves code simplicity: If the Single Responsibility Principle in C# is respected and not violated, classes should only contain a single property or method.The following reasons are the most important reasons in terms of impact on development and time: The number of advantages for using this SOLID principle, as I said before, are many. Main Benefits of C# Single Responsibility PrincipleĪt this time you may now be wondering what are the benefits of using Single Responisiblity Principle in C#. We are also going to see and explain the main benefits and advantages of using SRP in our C# code. You can save a lot of development time!Īnother advantage of using Single Responsibility Principle is coherence, that is, although each method does different things, when they are united they do one thing together and do it well. If the Single Responsibility principle is followed, it is possible to reuse the logic of that code in other parts of the application or directly reuse it in another project. The biggest advantage of follow the C# SRP is to have a clean c# code, reducing its complexity and turning it into a simple and easy to read code.Īnother great advantage of implementing SRP in C# code is to gain the ability to reuse or recycle code excerpts. It’s like a developer, it doesn’t matter if it’s you or me, if we are developers and our responsibility is to develop but at the same time we do Marketing, yes, we are gods but we are not complying with the Single Responsibility Principle! Why you should follow the Single Responsibility Principleīy implementing SRP in the code you can achieve several benefits at the code level and also save time.

violation of single responsibility principle

If you have a class in C# that does X thing and also does Y thing, I would suspect that you are not complying with the Single Responsibility Principle. “Enforce that a class only does one thing”

violation of single responsibility principle

Even though this single reason to change sounds a bit weird (and Martian in my opinion👽), so self-explained will be:















Violation of single responsibility principle