Usando medição de código fonte para refractoring - Carneiro, Glauco de Figueiredo (2003)
Software refactoring - improving the internal structure of the software without changing its observable behavior - is an important action towards avoiding software quality decay. Key to this activity is the identification of portions of the source code that offers opportunities for refactoring - the so called "code bad smells". This dissertation proposes an approach to help on the detection of code bad smells through source code measurement. To solve this problem, however, other stages still not implemented are necessary. This dissertation focuses on the first step towards a concrete method to detect code bad smells through source code measurement. It presents a study that relates metrics, refactorings, and bad smells. Our study is broken into two parts. The first - top-down - part is based on the analytical application of the Goal-Question-Metric (GQM) method. The second - bottom-up - part is an empirical study on the relationship between well-known source code metrics, refactorings and code bad smells. The GQM study identified the type of metrics that are needed for each of the bad smells proposed by Fowler. The study shows that 75% of the needed metrics are not available. But, 78% of those can be implemented, while the remainder is strongly dependent on human cognitive analysis, therefore difficult if not impossible to implement. The empirical study analyzed 47 source code metrics over a case study - these metrics make up a comprehensive set among those commercially available on software measurement tools. The case study measured the variation of these metrics over a sequence of 77 refactorings. The study used two customized association measures to relate metrics and refactorings - metric-refactoring association coefficient (MRAC) and metric- refactoring strong association coefficient (MRSAC) - and the results of those associations are presented for the refactorings executed during the case study.