From Bad Smells to Refactoring: Metrics Smoothing the Way
Yania Crespo (Universidad de Valladolid, Spain), Carlos Lopez (Universidad de Burgos, Spain) and Maria Esperanza Manso Martinez (Universidad de Valladolid, Spain)
Copyright: © 2007
This chapter presents a study on the relation of refactoring, bad smells, and metrics. The notions of refactoring and bad smells are revised as well as metrics that can be used as guides in the refactoring process. Connection among those metrics, the usual flaws that could be suggested by them, and the required corrective actions to reduce or erase these flaws are analyzed. The usual flaws can be described in terms of bad smells and the corrective actions, in terms of the refactoring operations suggested by each bad smell. Then, we can go from metrics to bad smells and from this, to refactoring. The chapter also describes solutions for tool support in a language independent manner. In this sense, it describes the tool architecture which can be defined as metamodel-centered. A metamodel representing a family of languages is defined as well as framework based solutions for collecting metrics, as well as for a refactoring engine and repository. These solutions allow reusing the effort on a wide family of object-oriented languages. Thedeveloped frameworks were instantiated to work on instances of our own metamodel. In addition to this, it also describes how to use the approach and its support, with other metamodels. Finally, a case study on the use of metrics in bad smells detection is presented.