Bad smells are sub-optimal code structures that may represent problems that need attention. We conduct an extensive literature review on a huge body of knowledge from 1990 to 2017. We show that some smells are much more studied in the literature than others and some of them are intrinsically inter-related (which). We give a perspective on how the research has been driven across time (when). In particular, while the interest in duplicated code emerged before the reference publications by Fowler and Beck and by Brown et al., other types of bad smells started to be studied only after these seminal publications, with an increasing trend in the last decade. We analyzed aims, findings, and respective experimental settings and observed that the variability on these elements may be responsible for some apparently contradictory findings on bad smells (what). Moreover, while in general bad smells of different types are studied together, only a small percentage of these studies actually investigate the relations between them (co-studies). In addition, only few relations between some types of bad smells were investigated, while there are other possible relations for further investigation. We also noted that authors have different levels of interest in the subject, some of them publishing sporadically and others continuously (who). We observed that scientific connections are ruled by a large “small world” connected graph among researchers and several small disconnected graphs. We also found that the communities studying duplicated code and other types of bad smells are largely separated. Finally, we observed that some venues are more likely to disseminate knowledge on Duplicate Code (which often is listed as a conference topic on its own), while others have a more balanced distribution among other smells (where). Finally, we provide a discussion on future directions for bad smell research.
On the other hand, bad smells may not be as harmful S as generally claimed. Rahman et al.  report that bugs are not signiﬁcantly associated to duplicated code. Also, in some situations, writing code with the presence of bad smells may be even the best option for developers . Although a huge body of knowledge has been produced over almost 30 years, it still lacks more organization. So, this paper aims at elaborating a systematic literature review on bad smells between the years 1990 and 2017 taking into consideration the diversity of different kinds of bad smells (which); the evolution of the interest of researchers in bad smells (when); the aims, ﬁndings, and material for experimental setup (what); the different people and groups oftware systems need to evolve continuously to cope with new requirements and environment changes. High quality source code plays an important role in this context because the code itself needs to be easy to understand, analyze, change, maintain, and reuse . However, software developers eventually produce sub-optimal code, possibly introducing design problems, i.e., they produce code structures that violate fundamental principles in software engineering, such as high cohesion and low coupling. This situation is also known as “technical debt” , a debt that developers have with the system organization. In the shortterm, technical debts may bring beneﬁts, such as, higher productivity or shorter release time, but in the long-term debts can cause a signiﬁcant amount of extra work. Some studies have reported on the negative impact of bad smells in software maintenance. Aiko and Leon  report that 27% of maintenance problems are related to bad smells. On the design side, relationships between architecture problems and bad smells have also been reported [318, 320]. Gurp and Bosch  report that architectural problems could cause software discontinuity or loss of hegemony. Bad smells could be used as indicators for low code quality code, representing potential threats . interested in bad smells (who); the distribution of papers among venues (where) Although there are already some surveys on bad smells, they do not cover the literature in a comprehensive way. Differently from previous work [5, 6, 7, 235], we propose a methodology aimed at minimizing the possibility of missing relevant papers. As a result, unlike Zhang et al.  we show that the research interest (measured by number of papers) on bad smells has increased over the years and many more papers have recently studied the impact of bad smells. Another distinguishing characteristic of our work is the investigation of the co-occurrence of different bad smells in the same paper. We will show that while DUPLICATE CODE is widely studied, there are only a few studies that consider the combination of DUPLICATE CODE with other kinds of bad smells, conﬁrming on a much larger scale the results obtained by Zhang et al. . Moreover, if we disregard those papers that study only DUPLICATE CODE, we observe that the other kinds of bad smells are typically studied with other smells (e.g., a paper investigating LARGE CLASS and FEATURE ENVY). That kind of co-occurrence of bad smells in papers has not been addressed in previous reviews. Moreover, the co-occurrence of smells in the same paper does not imply that any inter-relationship between them is investigated. We further investigate this matter, reporting on smells that are co-studied for investigation on the inter-relationship raised by their co-occurrence in code. Considering this difference between papers about DUPLICATED CODE and papers about other types of bad smells and considering that there are previous surveys considering only papers about DUPLICATED CODE [6, 235], we observe that DUPLICATED CODE can be considered as a topic on its own deserving a different and more speciﬁc systematic literature review, with respect to the one presented in this paper. For this reason, in some RQs, we do not consider papers discussing DUPLICATED CODE, and only focus on the other types of smells, in particular the RQs concerning the thematic area what. We consider papers concerning DUPLICATED CODE in RQs where we want to emphasize the difference with papers about other smell types. Also, we will refer to papers studying only DUPLICATED CODE as Duplicated Code Group (DCG), whereas we will refer to papers studying other types of bad smells as Other Bad Smell Group (OBSG).
The main contributions of this paper are:
- a very large-scale review on bad smells, the largest if compared to previous surveys;
- a systematic organization of the ﬁndings on bad smells other than DUPLICATED CODE produced over more than a decade in more than a hundred papers, to unveil the convergent, divergent and main ﬁndings;
- a real interpretation of the reported ﬁndings, with further anecdotal evidence obtained from the consolidated results;
- several statistical descriptions of data to characterize the area, including a clear characterization of collaborations among researchers using Social Network Analysis;
- avenues for further work which would help the community, either experts or newcomers to this ﬁeld.
We conducted a systematic literature review in order to investigate the current relevant body of knowledge about the bad smells. Our review is composed of a set of 351 papers (Final Database), which are classiﬁed as Duplicate Code Group (DCG) or Other Bad Smell Group (OBSG). We mainly focused on OBSG papers, because we noticed that DUPLICATED CODE is a very well deﬁned topic with previous surveys already available and a community largely separated from the OBSG community. In addition, DUPLICATED CODE is generally studied alone, while we were interested in understanding how different types of smells are studied together. We presented the main ﬁndings in ﬁve Thematic Areas (TAs). TA1: Which. The data revealed that the DUPLICATE CODE bad smell is present in 69.8% of the selected papers, and studies considering the combination of DUPLICATE CODE with other bad smells are not common (7.4% — 18 out of 245). However, analyzing the other kinds of bad smells (OBSG), we observed that they are rather studied together with others (e.g., LONG METHOD occurs in 47.1% of papers that study the smell LARGE CLASS). Currently, most OBSG papers are concentrated in studying bad smells characterized by volume metrics. Moreover, although the number of different kinds of bad smells have been proliferating over the years, the most studied smells are still a half-dozen, mostly related to size and cohesion. It is not clear that the long tail of less studied kinds of smells can play an important role in assessing design because of their low prevalence, but still they would possibly provide more precise information than just saying that a class is large, without more precise clues on what to do next. We also observed that most of the earliest bad smells (e.g., Brown et al. ) have not received due attention, that is, they are peripheral concerning the number of studies. The bad smells by Brown et al.  are present in 21.7% of OBSG papers. Similarly, but to a greater extent, the bad smells by Fowler and Beck  are present in 82.2% of OBSG papers. From the point of view of the variety of different identiﬁed bad smells (104 in total), we observed that most of them (58%) were sporadically studied. In this case, they were studied by up to ﬁve papers (see Table 15), that is, they seem to have still just a marginal interest. TA2: When. Analyzing the studies over time, we observed that studies on DUPLICATE CODE had increased until 2014, but decreased since 2015, whereas studies on the other smells have a linear growth, with a peak in 2013. We also observed that before the year 2011, only 21% of papers studied other types of bad smells and after this period, this value grew up to 45%. This increment of OBSG papers is reﬂected in the number of authors: between 2010 and 2017 the cumulative number of distinct authors increased of 67%. Thus, the identiﬁcation and analysis of bad smells is a growing topic that has been continuously attracting interest. The data indicate that the interest (number of papers) in this research topic has been rising over the years, and new researchers are joining the area every year. TA3: What. Concerning methodological aspects and research ﬁndings, the literature presents several types of bad smells and sometimes a given bad smell presents multiple deﬁnitions or interpretations. Moreover, different elements of experimental setting such as research aims, subject systems, used tools have large variability. So, the lack of adoption of open science (represented by the insufﬁcient availability of standard and open benchmarks and tools) partially contributes to the existence of multiple ways of analyzing the bad smell impact, thus, explaining why the results of some papers may be contradictory. We have systematically organized the ﬁndings produced over more than a decade to unveil the convergent, divergent and main ﬁndings. Our results also suggest that studying a particular combination of bad smells just because they are present in the code or because they are conveniently detected by tools may not provide a formal explanation that relates those bad smells (e.g., REFUSED BEQUEST and LONG METHOD). Additionally, co-studying bad smells, i.e., investigating the interaction of different smells on affected code components, looks promising and may help to reveal conditions where bad smells are relevant to software maintenance. We also observed that 21% of papers classiﬁed as co-occurrence can be actually considered as co-studies and only 18% of the 104 smells documented in our dataset are investigated in empirical co-studies. As mentioned previously and also reported by Zhang et al. , many bad smells have a marginal interest (e.g., MIDDLE MAN, PRIMITIVE OBSESSION, PARALLEL INHERITANCE HIERARCHIES). We think that they have been neglected because there is few evidences of their negative impact on source code. However, it would be interesting to include these smells in co-studies investigating their interaction with widely studied bad smells. For example, Mantyla et al.  report that PARALLEL INHERITANCE HIERARCHIES cause REFUSED BEQUEST, which in turn may be related to LONG METHODS. Finally, we also identiﬁed the main purposes of papers and our data shows that Detection (30.7%), Impact (24.3%), and Qualitative Characterization (11.4%) are the most frequent aims. TA4: Who. Concerning the researchers studying other bad smells than DUPLICATE CODE, we observed that they have several levels of interest in the subject, that is, some of them publish sporadically and others continuously. There is a large connected graph of collaborating authors that has the small world property, indicating high ﬂow of information within that group of researchers. On the other hand, there is a large number of smaller disconnected graphs which still produce a signiﬁcant part of studies (44%). This division between a large connected group and many isolated groups unveils the dynamics of how the ﬁndings are being produced. We also observed that some research centers are highly interconnected to others. TA5: Where. We showed that some venues have a much higher proportion of studies on DUPLICATE CODE, while others are more balanced with other bad smells. The presence in the list of topics of some conference of speciﬁc topics concerned with DUPLICATED CODE and generic topics on bad smells might explain why the community working only on DUPLICATE CODE and the community working on the other types of smells are largely separated. In general, our results show that a large body of knowledge has been produced on bad smells. Nonetheless, there are still some divergences due to the lack of generality of current studies. Moreover, despite the several different kinds of associations that have been found regarding bad smells in code, there is little evidence on cause-effect relations that would provide more actionable knowledge on available empirical data.
The Kavian Scientific Research Association (KSRA) is a non-profit research organization to provide research / educational services in December 2013. The members of the community had formed a virtual group on the Viber social network. The core of the Kavian Scientific Association was formed with these members as founders. These individuals, led by Professor Siavosh Kaviani, decided to launch a scientific / research association with an emphasis on education.
KSRA research association, as a non-profit research firm, is committed to providing research services in the field of knowledge. The main beneficiaries of this association are public or private knowledge-based companies, students, researchers, researchers, professors, universities, and industrial and semi-industrial centers around the world.
Our main services Based on Education for all Spectrum people in the world. We want to make an integration between researches and educations. We believe education is the main right of Human beings. So our services should be concentrated on inclusive education.
The KSRA team partners with local under-served communities around the world to improve the access to and quality of knowledge based on education, amplify and augment learning programs where they exist, and create new opportunities for e-learning where traditional education systems are lacking or non-existent.
IEEE Transactions on Software Engineering
PDF reference and original file: Click here