A software metric for coherence of class roles in Java programs
Sami Mäkelä, Ville Leppänen · 2007
The purpose of software metrics is to measure the quality of programs. The results can be for example used to predict maintenance costs or improve code quality. An emerging view is that if software metrics are going to be used to improve quality, they must help in finding code that should be refactored. Often refactoring or applying a design pattern is related to the role of the class to be refactored. In client-based metrics, a project gives the class a context. These metrics measure, how a class is used by other classes in the context. We present a new client-based metric LCIC (Lack of Coherence in Clients), which analyses, if the class being measured has a coherent set of roles in the program. Interfaces represent the roles of classes. If a class does not have a coherent set of roles, it should be refactored, or a new interface should be defined for the class.