· CouplingBetweenObjects: This rule counts unique attributes, local variables and return types within an object. A number higher than specified threshold can indicate a high degree of coupling.
翻译 对象间的耦合:这个规则统计一个对象中单个的属性、本地变量和返回类型的数目。如果统计数目大于指定的上限值表示耦合度太高。
· ExcessiveImports: A high number of imports can indicate a high degree of coupling within an object. Rule counts the number of unique imports and reports a violation if the count is above the user defined threshold.
翻译 过多的引入:大量的import表明对象有很高的耦合度。本规则统计单一的import数目,如果数目大于用户定义的上限则报告一个违例。
· LooseCoupling: Avoid using implementation types (i.e., HashSet); use the interface (i.e, Set) instead
翻译 松耦合:避免使用具体实现类型(如:HashSet);用接口(如:Set)代替。

本文探讨了如何通过减少对象间不必要的联系来提高软件质量。主要内容包括:对象间的耦合规则、避免过度导入以减少耦合度,以及推荐使用接口而非具体实现类型的方法。
3378

被折叠的 条评论
为什么被折叠?



