770 research outputs found
A heuristic-based approach to code-smell detection
Encapsulation and data hiding are central tenets of the object oriented paradigm. Deciding what data and behaviour to form into a class and where to draw the line between its public and private details can make the difference between a class that is an understandable, flexible and reusable abstraction and one which is not. This decision is a difficult one and may easily result in poor encapsulation which can then have serious implications for a number of system qualities. It is often hard to identify such encapsulation problems within large software systems until they cause a maintenance problem (which is usually too late) and attempting to perform such analysis manually can also be tedious and error prone. Two of the common encapsulation problems that can arise as a consequence of this decomposition process are data classes and god classes. Typically, these two problems occur together – data classes are lacking in functionality that has typically been sucked into an over-complicated and domineering god class. This paper describes the architecture of a tool which automatically detects data and god classes that has been developed as a plug-in for the Eclipse IDE. The technique has been evaluated in a controlled study on two large open source systems which compare the tool results to similar work by Marinescu, who employs a metrics-based approach to detecting such features. The study provides some valuable insights into the strengths and weaknesses of the two approache
Evaluation of Kermeta for Solving Graph-based Problems
Kermeta is a meta-language for specifying the structure and behavior of graphs of interconnected objects called models. In this paper,\ud
we show that Kermeta is relatively suitable for solving three graph-based\ud
problems. First, Kermeta allows the specification of generic model\ud
transformations such as refactorings that we apply to different metamodels\ud
including Ecore, Java, and Uml. Second, we demonstrate the extensibility\ud
of Kermeta to the formal language Alloy using an inter-language model\ud
transformation. Kermeta uses Alloy to generate recommendations for\ud
completing partially specified models. Third, we show that the Kermeta\ud
compiler achieves better execution time and memory performance compared\ud
to similar graph-based approaches using a common case study. The\ud
three solutions proposed for those graph-based problems and their\ud
evaluation with Kermeta according to the criteria of genericity,\ud
extensibility, and performance are the main contribution of the paper.\ud
Another contribution is the comparison of these solutions with those\ud
proposed by other graph-based tools
Deuce: A Lightweight User Interface for Structured Editing
We present a structure-aware code editor, called Deuce, that is equipped with
direct manipulation capabilities for invoking automated program
transformations. Compared to traditional refactoring environments, Deuce
employs a direct manipulation interface that is tightly integrated within a
text-based editing workflow. In particular, Deuce draws (i) clickable widgets
atop the source code that allow the user to structurally select the
unstructured text for subexpressions and other relevant features, and (ii) a
lightweight, interactive menu of potential transformations based on the current
selections. We implement and evaluate our design with mostly standard
transformations in the context of a small functional programming language. A
controlled user study with 21 participants demonstrates that structural
selection is preferred to a more traditional text-selection interface and may
be faster overall once users gain experience with the tool. These results
accord with Deuce's aim to provide human-friendly structural interactions on
top of familiar text-based editing.Comment: ICSE 2018 Paper + Supplementary Appendice
Avoiding Unnecessary Information Loss: Correct and Efficient Model Synchronization Based on Triple Graph Grammars
Model synchronization, i.e., the task of restoring consistency between two
interrelated models after a model change, is a challenging task. Triple Graph
Grammars (TGGs) specify model consistency by means of rules that describe how
to create consistent pairs of models. These rules can be used to automatically
derive further rules, which describe how to propagate changes from one model to
the other or how to change one model in such a way that propagation is
guaranteed to be possible. Restricting model synchronization to these derived
rules, however, may lead to unnecessary deletion and recreation of model
elements during change propagation. This is inefficient and may cause
unnecessary information loss, i.e., when deleted elements contain information
that is not represented in the second model, this information cannot be
recovered easily. Short-cut rules have recently been developed to avoid
unnecessary information loss by reusing existing model elements. In this paper,
we show how to automatically derive (short-cut) repair rules from short-cut
rules to propagate changes such that information loss is avoided and model
synchronization is accelerated. The key ingredients of our rule-based model
synchronization process are these repair rules and an incremental pattern
matcher informing about suitable applications of them. We prove the termination
and the correctness of this synchronization process and discuss its
completeness. As a proof of concept, we have implemented this synchronization
process in eMoflon, a state-of-the-art model transformation tool with inherent
support of bidirectionality. Our evaluation shows that repair processes based
on (short-cut) repair rules have considerably decreased information loss and
improved performance compared to former model synchronization processes based
on TGGs.Comment: 33 pages, 20 figures, 3 table
Fortran refactoring for legacy systems
The motivation of this work comes from a Global Climate Model (GCM) Software which was in great need of being updated. This software was implemented by scientists in the ’80s as a result of meteorological research. Written in Fortran 77, this program has been used as an input to make climate predictions for the Southern Hemisphere. The execution to get a complete numerical data set takes several days. This software has been programmed using a sequential processing paradigm. In these days, where multicore processors are so widespread, the time that an execution takes to get a complete useful data set can be drastically reduced using this technology. As a first objective to reach this goal of reengineering we must be able to understand the source code. An essential Fortran code characteristic is that old source code versions became unreadable, not comprehensive and sometimes “ejects” the reader from the source code. In that way, we can not modify, update or improve unreadable source code. Then, as a first step to parallelize this code we must update it, turn it readable and easy to understand.
The GCM has a very complex internal structure. The program is divided into about 300 .f (Fortran 77) files. These files generally implement only one Fortran subroutine. Less than 10% of the files are used for common blocks and constants. Approximately 25% of the lines in the source code are comments. The total number of Fortran source code lines is 58000. A detailed work within the source code brings to light that [74]:
1 About 230 routines are called/used at run time. Most of the runtime is spent in routines located at deep levels 5 to 7 in the dynamic call graph from the main routine.
2 The routine with most of the runtime (the top routine from now on) requires more than 9% of the total program runtime and is called about 315000 times.
3 The top 10 routines (the 10 routines at the top of the flat profile) require about 50% of total runtime. Two of them are related to intrinsic Fortran functions.
Our first approach was using a scripting language and Find & Replace tools trying to upgrade the source code, this kind of code manipulation do not guarantee preservation of software behavior.
Then, our goal was to develop an automated tool to transform legacy software in more understandable, comprehensible and readable applying refactoring as main technique. At the same time a catalog of transformation to be applied in Fortran code is needed as a guide to programmers through this process.Es revisado por: http://sedici.unlp.edu.ar/handle/10915/9703Facultad de Informátic
- …