《架构整洁之道》:Chap8. OCP: THE OPEN-CLOSED PRINCIPLE OCP:开闭原则
The Open-Closed Principle (OCP) was coined in 1988 by Bertrand Meyer.1 It says: 开闭原则(OCP)是 Bertrand Meyer 在 1988 年提出的,该设计原则认为: A software artifact should be open for extension but closed for modification. 设计良好的计算机软件应该易于扩展,同时抗拒修改。 In other words, the behavior of a software artifact ought to be extendible, without having to modify that artifact. 换句话说,一个设计良好的计算机系统应该在不需要修改的前提下就可以轻易被扩展。 This, of course, is the most fundamental reason that we study software architecture. Clearly, if simple extensions to the requirements force massive changes to the software, then the architects of that software system have engaged in a spectacular failure. ...