In the design of the program, in the face of the increase in demand, it is not blindly increasing the amount of code in a class, which will increase the degree of coupling, so just add new code for the same requirements, and add classes or other codes through inheritance and polymorphism. The principle of open and closed is to make the code maintainable, reusable, and flexible.
Dahua Designer Pattern--Open--Closed Principle
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=325658351&siteId=291194637
Recommended
Ranking