- 冒号空间 - https://blog.zhenghui.org -

为什么是这4个原则?

设计原则有很多,比如熟悉的DRY,SOLID等原则。本书选择了间接,依赖,内聚和保变4个设计原则作为大的分类。这样选择的用意是什么呢?


SCIP先讲了抽象(等同于间接),然后讲模块化(等同于内聚),可能SCIP的作者也认为抽象和内聚应该是一级原则。下面是SCIP的一段话:


The preceding chapters introduced the basic elements from which programs are made. We saw how primitive procedures and primitive data are combined to construct compound entities, and we learned that abstraction is vital in helping us to cope with the complexity of large systems. But these tools are not sufficient for designing programs. Effective program synthesis also requires organizational principles that can guide us in formulating the overall design of a program. In particular, we need strategies to help us structure large systems so that they will be modular, that is, so that they can be divided naturally” into coherent parts that can be separately developed and maintained.


Share