M. Jarke et al. (Eds.): CAiSE 2014, LNCS 8484, pp. 656–671, 2014.
© Springer International Publishing Switzerland 2014
On the Effectiveness of Concern Metrics to Detect Code
Smells: An Empirical Study
Juliana Padilha
1
, Juliana Pereira
1
, Eduardo Figueiredo
1
, Jussara Almeida
1
,
Alessandro Garcia
2
, and Cláudio Sant’Anna
3
1
Computer Science Department, Federal University of Minas Gerais, Belo Horizonte, Brazil
{juliana.padilha,juliana.pereira,figueiredo,jussara}@dcc.ufmg.br
2
Informatics Department, Pontifical Catholic University of Rio de Janeiro (PUC-RIO), Brazil
afgarcia@inf.puc-rio.br
3
Computer Science Department, Federal University of Bahia (UFBA), Brazil
santanna@dcc.ufba.br
Abstract. Traditional software metrics have been used to evaluate the
maintainability of software programs by supporting the identification of code
smells. Recently, concern metrics have also been proposed with this purpose.
While traditional metrics quantify properties of software modules, concern
metrics quantify concern properties, such as scattering and tangling. Despite
being increasingly used in empirical studies, there is a lack of empirical
knowledge about the effectiveness of concern metrics to detect code smells. This
paper reports the results of an empirical study to investigate whether concern
metrics can be useful indicators of three code smells, namely Divergent Change,
Shotgun Surgery, and God Class. In this study, 54 subjects from two different
institutions have analyzed traditional and concern metrics aiming to detect
instances of these code smells in two information systems. The study results
indicate that, in general, concern metrics support developers detecting code
smells. In particular, we observed that (i) the time spent in code smell detection
is more relevant than the developers’ expertise; (ii) concern metrics are clearly
useful to detect Divergent Change and God Class; and (iii) the concern metric
Number of Concerns per Component is a reliable indicator of Divergent Change.
Keywords: Empirical evaluation, Metrics, Code Smells, Concerns.
1 Introduction
The modularization of the driving design concerns is a key factor to achieve
maintainable information systems [16, 21]. A concern is any important property or
area of interest of a system that we want to treat in a modular way [23]. Business
rules, distribution, persistence, and security are examples of typical concerns found in
many information systems and that are important, albeit hard, to achieve full
modularization. The inadequate separation of concerns degrades design modularity
and may lead to maintainability-related design flaws [6, 11]. Detection of these design
flaws by programmers is far from trivial and requires effective support.
Software metrics are the key means for assessing the maintainability of information
systems [3, 7]. The community of software metrics has traditionally explored
quantifiable module properties, such as class coupling, cohesion, and interface size,
in order to identify maintainability problems in a software project [3, 8, 19, 20].