Stable Abstractions Principle (SAP)
A component's level of abstraction should be equal to its stability.
- A principle about the relationship between abstraction and stability.
- A component with high stability should also have high abstraction, and high stability should not obstruct extension.
- A low-stability component should be concrete.
- High stability makes internal concrete code harder to modify.
- To keep a component stable and still extensible, design it with interfaces and abstract classes.
- If a component is to be stable, make it extendable by interfaces and abstract classes.
- SAP + SDP corresponds to the component-level Dependency Inversion Principle.
- Stability and abstraction are correlated.
Measuring Abstraction
A measure of a component's abstraction is A.
Nc- Total number of classes in the component
Na- Number of abstract classes and interfaces in the component
A- Abstraction
A = Na ÷ Nc
Amazon アソシエイトについて
この記事には Amazon アソシエイトのリンクが含まれています。Amazonのアソシエイトとして、SuzumiyaAoba は適格販売により収入を得ています。
