4.7. Buenas prácticas en el cooperativismo y la economía solidaria
4.7.2. Experiencias de buenas prácticas reconocidas por el sector
thesis tackles is:
Do source code characteristics affect the maintenance of an application?
A metaphor can illustrate this question. In civil engineering, not only the design of a building must be sound but also the materials with which it is built: using low quality concrete can also compromise the lifetime of the building. However, in software engineering it is not clear if the quality of the source code can compromise the evolution of an application, and if so, which source code characteristics have the worse impact, and therefore, should be an anti-regressive work priority.
Assuming that software structure impacts software maintenance, minor issues on the implementation may also have consequences on the application’s sustainability and longevity. However optimizing the time used for anti-regressive work is a challenging task because it is not clear which source characteristics are harmful and to what extent.
We will use the term S o u r c e C o d e I s s u e s ( S C I ) to refer to source code characteristics that have been pointed out as unhealthy implementation practices. Source Code Issues include: clones (replicated code), god methods (too many responsibilities in a method), god classes (classes that represent more than one abstraction), feature envy (methods that use more fields of other classes than the filed of its own class), etc. Source Code Issues occur at different levels of abstraction. Different types of Source Code Entities (SCE) enclose different SCIs, for instance, god classes occur only in classes, while feature envy occurs only in methods. There are already several approaches to detect SCI, however very little is known about the effect of SCI on the maintainability of the application.
In order to analyze these questions, we investigated the effect of clones on the changeability of methods. Therefore, the research question was refined to:
Is being cloned harmful for the changeability of methods?
This investigation has led us to propose a methodology to analyze the effect of Source Code Issues on the changeability of the Source Code Entities that hosts them.
1.3
Proposed approach
This section motivates and presents a methodology based on empirical observations to analyze the effect of source code issues in maintainability.
1.3.1
Need for a methodology to validate quality frameworks
Q u a l i t y f r a m e w o r k s are theoretic constructions that aim to assess properties of software applications. One of the disadvantages of quality frameworks is that the quality of the application has a different meaning depending on the stakeholder [Kitchenham '96]. For instance; in terms or software evolution, quality is related to the ease of the application to accommodate major changes; but in terms of the software product, quality is related to the number of faults.
Most quality frameworks attempt to assess the quality of an application based on its internal characteristics. However, this approach has one important disadvantage: several characteristics contradict each other, for instance, high cohesion and low coupling. Therefore, it is not possible to optimize an application’s structure to achieve an optimal value in all its internal characteristics. However, it is possible to balance the values among conflicting characteristics. Nevertheless, quality frameworks do not give much insight about how to achieve such balance. In consequence, achieving a high quality application becomes a problem of balancing characteristics without knowing their weight on the quality goal.
Another issue about quality frameworks is that they are theoretical constructions without empirical validation to support their claims. As a result, there is a plethora of quality frameworks proposing similar characteristics with no standard vocabulary, proposing different ways to achieve the same quality goal (see for instance the different decompositions of maintainability above on Figure 1-1). Besides, the lack of evaluation makes quality frameworks incomplete, and probably, inconsistent with real life projects [Moody '05].
Summarizing, quality frameworks explain how to achieve quality attributes but only up to design level. They do not state how to achieve a quality attribute at implementation level [Marinescu '02]. There is no agreement on how implementation heuristics would achieve a quality attribute at design level. Although there are recent quality-models that propose implementation heuristics to achieve a quality attribute [Marinescu '02][Moha '08], different quality-models give different (and in some cases contradictory) heuristics to achieve the same quality attribute [Marinescu '02][Moha '08]. These divergences in quality-models that integrate source code heuristics could be solved by analyzing the effect of not using the heuristics on certain quality attributes of the application.
1.3. Proposed approach
1.3.2
Proposed methodology
Practitioners are not aware of quality frameworks [Moody '05]. In fact, there is not even a de- facto standard quality framework [Moody '05]. Although most practitioners maintain applications at source code level [Singer '98], it is not known to what extent a source code characteristic that is believed to be harmful affects the maintainability of an application.
We think that it is possible to find facts about the nature of programs from the common results from diverse applications. Therefore, we propose to perform a set of analyses, on several applications, to assess the impact of the SCI. Finding similar results regardless of the applications analyzed, is more likely to be due to the analyzed characteristic than due to random similarities among the applications. Moreover, the greater the number of applications analyzed the smaller the effects of particular characteristics of each application are.
In summary, quality frameworks lack of validation that could be given by empirical methods. We propose an empirically based methodology to assess the effect of source code characteristics that are considered harmful in the maintenance of the application. Our methodology is aimed at researchers in software engineering that want to analyze the effect of a source code characteristic on the changeability of the final application. In particular, when there are reasons to believe that the source code characteristic is harmful. However, it is not necessary to apply the whole methodology for each source code characteristic to analyze. Given that each step tackles different research questions, some steps can be avoided because their questions may have been answered by previous work.
In order to evaluate the methodology proposed, we analyze the effect of cloned code (SCI) in methods (SCE). Clones are duplicated code, and they are believed to be harmful because they may require duplicated maintenance.
1.3.3
Contributions
This thesis presents a methodology to assess the effect of a Source Code Issue on the ease of changing the Source Code Entity that has it. However, the contribution of thesis is not limited to the methodology, but also to the findings obtained by applying it to clones at the level of methods. We confirm that several of the hypotheses about the harmfulness of clones. Firstly, cloned methods change more than code that is not cloned, and that these extra-changes occur inside of the cloned fragments. Secondly, that cloned methods have a higher changeability than
methods without clones. Thirdly, that cloned methods with highest changeability decay are those that are sometimes cloned, possibly due to inconsistent changes.
We have also shown that the nature of the method is critical for identifying methods with high changeability. This is also true for cloned methods, as method characteristics were found as better discriminator of the changeability of cloned methods than clone characteristics.
Finally, we have found that contrary to previous findings, cloning is persistent. Methods cloned, tend to remain cloned all their lifetime.