
Continuous Design
https://www.martinfowler.com/ieeeSoftware/continuousDesign.pdf
Therising popularity of refactoring, toolssuch as JUnit, and agile methodologiessuch as Extreme Programming (XP) hasbrought a new style of design into view.Continuous designis the process of us-ing refactoring to continuously improvea program’s design. Initially a skeptic, I’ve beenexperimenting with continuous design for fouryears, and it’s changed the way I program
Design Goals in Continuous DesignContinuous design makes change easy by focusing on these design goals:■DRY (Don’t Repeat Yourself):There’s little duplication.■Explicit:Code clearly states its purpose, usually without needing comments.■Simple:Specific approaches are preferred over generic ones. Design pat-terns support features, not extensibility.■Cohesive:Related code and concepts are grouped together.■Decoupled:Unrelated code and concepts can be changed independently.■Isolated:Third-party code is isolated behind a single interface.■Present-day:The design doesn’t try to predict future features.■No hooks:Interfaces, factory methods, events, and other extensibility “hooks”are left out unless they meet a current need
Cohesive
内聚 -- 相关的代码和逻辑,放在一起。 不要离散存放。
Isolated & Decoupled
去耦合 -- 将无关和不必要的粘连,切除掉。目标为更加内聚。
隔离 -- 将不同内聚的模块, 切分清楚, 将模块之间的接口描述清楚。