Open-Closed Principle 

The approach for designing and eventually writing production code should be the one that allows new functionalities to be added to a project's code base without having to make many changes, change several portions or classes of the code base, or break existing functionalities that were already working and in good condition.

If, for any reason, you make changes to a method in a class and as a result of the changes, changes have to be made to several parts or modules, it's an indication of a problem with the code design. This is what the Open-Closed Principle (OCP) addresses, to allow your code base design to be flexible, so that you can easily make modifications and enhancements.

The OCP states that software entities, ...

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.