![]() Code is changed less frequently - in general, when requirements change, not every part of the application is going to change because the classes are more specific.Code becomes easier to maintain - Less is more, as the classes don't deal with multiple things.Code becomes easier to understand - there is less happening when the implementation is more specific, as the classes are more concise.There are great benefits of applying SRP: ![]() ![]() This principle is applied to classes and functions, and they need to have one responsibility, a single purpose. They are:Ī class should have one, and only one, reason to change These principles will help you to write clean code, with separation of concerns, cohesion, decoupling, helping with code reuse. As a developer, you must learn, not only the acronym meaning but also what they represent and when to use them. In different articles, all the principles will be approached. I'm not going to copy and paste all the history about it, you can check the details here, but in summary Robert Cecil Martin (aka Uncle Bob) introduced a paper about Design Principles and Design Patterns, summarised in his article The Principles of OOD, and then Michael Feathers later created the acronym SOLID. This post is part of a series where we explore the SOLID design principles, arguably the most popular design principles for object-oriented software development. In this article, the Single Responsibility Principle (SRP) is going to be explored. In this series, I would like to explore the SOLID principles using C#. Great developers are always curious and open to learning new programming languages, practices and principles in software development.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |