cohesion专题

Coupling and Cohesion

耦合和聚合(或者内聚)我敢保证这两个词,你会经常听到。同时我也敢说,你问一下你所有的同事,不会有几个人可以清楚地定义这两个词。以下定义来自《UML和模式应用 面向对象分析和设计导论》中译版,姚淑珍译。英文版《Applying UML and Patterns An introduction to Object-Oriented Analysis and Design》By Craig Larman

Object Oriented Design-coupling and cohesion

Firstly and most importantly, Designs that exhibit low coupling and high cohesion are preferred. What is coupling? coupling就是两个class之间的相关程度,所以越低越好。 Figure 1b provides an alternate design involving t