Single Responsibility Principle

The Single Responsibility Principle (SRP) is the first of the five SOLID principles. The principle states that a class must at any point in time have only one reason to change. This simply means that a class should only perform one duty at a time or have one responsibility.

The business requirements of software projects are not usually fixed. Before a software project is shipped and, indeed, throughout the life cycle of a software, requirements change from time to time and developers have to adapt the code base to the changes. In order for the software application to meet its business needs and adapt to changes, it is imperative that flexible design patterns are used and classes have a single responsibility ...

Get C# and .NET Core Test Driven Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.