面向对象设计原则(十一)SAP(稳定抽象原则)

SAP(The Stable Abstractions Principle,稳定抽象原则)

包的抽象程度应该和其稳定程度一致。

 

Packages that are maximally stable should be maximally abstract. Instable packages should be concrete. The abstraction of a package should be in proportion to its stability.

最稳定的包应该是最抽象的包。不稳定的包应该是具体的包。包的抽象程度跟它的稳定性成正比。

换成另一个说法是:

Stable packages should be abstract packages.

稳定的包应该是抽象的包。

你可能感兴趣的:(面向对象)