44 research outputs found
Safe Concurrency Introduction through Slicing
Traditional refactoring is about modifying the structure of existing code without changing its behaviour, but with the aim of making code easier to understand, modify, or reuse. In this paper, we introduce three novel refactorings for retrofitting concurrency to Erlang applications, and demonstrate how the use of program slicing makes the automation of these refactorings possible
Trustworthy Refactoring via Decomposition and Schemes: A Complex Case Study
Widely used complex code refactoring tools lack a solid reasoning about the
correctness of the transformations they implement, whilst interest in proven
correct refactoring is ever increasing as only formal verification can provide
true confidence in applying tool-automated refactoring to industrial-scale
code. By using our strategic rewriting based refactoring specification
language, we present the decomposition of a complex transformation into smaller
steps that can be expressed as instances of refactoring schemes, then we
demonstrate the semi-automatic formal verification of the components based on a
theoretical understanding of the semantics of the programming language. The
extensible and verifiable refactoring definitions can be executed in our
interpreter built on top of a static analyser framework.Comment: In Proceedings VPT 2017, arXiv:1708.0688
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
Dynamically typed languages
Dynamically typed languages such as Python and Ruby have experienced a rapid grown in popularity in recent times. However, there is much confusion as to what makes these languages interesting relative to statically typed languages, and little knowledge of their rich history. In this chapter I explore the general topic of dynamically typed languages, how they differ from statically typed languages, their history, and their defining features
Towards Trustworthy Refactoring in Erlang
Tool-assisted refactoring transformations must be trustworthy if programmers
are to be confident in applying them on arbitrarily extensive and complex code
in order to improve style or efficiency. We propose a simple, high-level but
rigorous, notation for defining refactoring transformations in Erlang, and show
that this notation provides an extensible, verifiable and executable
specification language for refactoring. To demonstrate the applicability of our
approach, we show how to define and verify a number of example refactorings in
the system.Comment: In Proceedings VPT 2016, arXiv:1607.0183
Transformation-based Refactorings: a First Analysis
International audienceRefactorings are behavior preserving transformations. Little work exists on the analysis of their implementation and in particular how refactorings could be composed from smaller, reusable, parts (being simple transformations or other refactorings) and how (non behavior preserving) transformations could be used in isolation or to compose new refactoring operators. In this article we study the seminal implementation and evolution of Refactorings as proposed in the PhD of D. Roberts. Such an implementation is available as the Refactoring Browser package in Pharo. In particular we focus on the possibilities to reuse transformations independently from the behavior preserving aspect of a refactoring. The long term question we want to answer is: Is it possible to have more atomic transformations and refactorings composed out of such transformations? We study preconditions of existing refactorings and identify several families. We identify missed opportunities of reuse in the case of implicit composite refactorings. We analyze the refactorings that are explicitly composed out of other refactorings to understand whether the composition could be expressed at another level of abstraction. This analysis should be the basis for a more systematic expression of composable refactorings as well as the reuse of logic between transformations and refactorings
Recommended from our members
Reflective and relativistic refactoring with feature-awareness
Refactoring is a core technology in modern software development. It is central to popular software design movements, such as Extreme Programming [23] and Agile software development [91], and all major Integrated Development Environments (IDEs) today offer some form of refactoring support. Despite this, refactoring engines have languished behind research. Modern IDEs offer no means to sequence refactorings to automate program changes. Further, current refactoring engines exhibit problems of speed and expressivity, which makes writing composite refactorings such as design patterns infeasible. Even worse, existing refactoring tools for Object-Oriented languages are unaware of configurations in Software Product Lines (SPLs) codebases. With this motivation in mind, this dissertation makes three contributions to address these issues: First, we present the Java API library, called R2, to script Eclipse refactorings to retrofit design patterns into existing programs. We encoded 18 out of 23 design patterns described by Gang-of-Four [57] as R2 scripts and explain why the remaining refactorings are inappropriate for refactoring engines. R2 sheds light on why refactoring speed and expressiveness are critical issues for scripting. Second, we present a new Java refactoring engine, called R3, that addresses an Achilles heel in contemporary refactoring technology, namely scripting performance. Unlike classical refactoring techniques that modify Abstract Syntax Trees (ASTs), R3 refactors programs by rendering ASTs via pretty printing. AST rendering never changes the AST; it only displays different views of the AST/program. Coupled with new ways to evaluate refactoring preconditions, R3 increases refactoring speed by an order of magnitude over Eclipse and facilitates computing views of a program where the original behavior is preserved. Third, we provide a feature-aware refactoring tool, called X15, for SPL codebases written in Java. X15 takes advantage of R3's view rendering to implement a projection technology in Feature-Oriented Software Development, which produces subprograms of the original SPL by hiding unneeded feature code. X15 is the first feature-aware refactoring tool for Java that implements a theory of refactoring feature modules, and allows users to edit and refactor SPL programs via “views”. In the most demanding experiments, X15 barely runs a second slower than R3, giving evidence that refactoring engines for SPL codebases can indeed be efficient.Computer Science
Dynamically typed languages.
Dynamically typed languages such as Python and Ruby have experienced a rapid grown in popularity in recent times. However, there is much confusion as to what makes these languages interesting relative to statically typed languages, and little knowledge of their rich history. In this chapter I explore the general topic of dynamically typed languages, how they differ from statically typed languages, their history, and their defining features
Verification and Application of Program Transformations
A programtranszformáciĂł Ă©s a refaktorálás alapvetĹ‘ elemei a szoftverfejlesztĂ©si folyamatnak. A refaktorálást a kezdetektĹ‘l prĂłbálják szoftvereszközökkel támogatni, amelyek megbĂzhatĂłan Ă©s hatĂ©konyan valĂłsĂtják meg a szoftverminĹ‘sĂ©get javĂtĂł, a működĂ©st nem Ă©rintĹ‘ programtranszformáciĂłkat. A statikus elemzĂ©sre alapulĂł hibakeresĂ©s Ă©s a refaktorálási transzformáciĂłk az akadĂ©miában Ă©s a kutatás-fejlesztĂ©sben is nagy Ă©rdeklĹ‘dĂ©sre tartanak számot, ám mĂ©g ennĂ©l is fontosabb a szerepĂĽk a nagy bonyolultságĂş szoftvereket kĂ©szĂtĹ‘ vállalatoknál. Egyre pontosabbak Ă©s megbĂzhatĂłbbak a szoftverfejlesztĂ©st támogatĂł eszközök, de bĹ‘ven van mĂ©g min javĂtani.
A disszertáciĂł olyan definĂciĂłs Ă©s verifikáciĂłs mĂłdszereket tárgyal, amelyekkel megbĂzhatĂłbb Ă©s szĂ©lesebb körben használt programtranszformáciĂłs eszközöket tudunk kĂ©szĂteni. A dolgozat a statikus Ă©s a dinamikus verifikáciĂłt is Ă©rinti. ElsĹ‘kĂ©nt egy Ăşjszerű, tömör leĂrĂł nyelvet mutat be L-attribĂştum grammatikákhoz, amelyet tulajdonságalapĂş tesztelĂ©shez használt vĂ©letlenszerű adatgenerátorra kĂ©pezĂĽnk le. Ehhez egy esettanulmány társul, amely az Erlang programozási nyelv grammatikáját, majd a tesztelĂ©shez valĂł felhasználását mutatja be. A tesztelĂ©s mellett a formális helyessĂ©gbizonyĂtás kĂ©rdĂ©sĂ©t is vizsgáljuk, ehhez bevezetĂĽnk egy refaktorálások leĂrására szolgálĂł nyelvet, amelyben vĂ©grehajthatĂł Ă©s automatikusan bizonyĂthatĂł specifikáciĂłkat tudunk megadni. A nyelv környezetfĂĽggĹ‘ Ă©s feltĂ©teles termátĂráson, stratĂ©giákon Ă©s Ăşgynevezett refaktorálási sĂ©mákon alapszik. VĂ©gĂĽl, de nem utolsĂł sorban a programtranszformáciĂłk egy speciális alkalmazása kerĂĽl bemutatásra, amikor egy refaktorálĂł keretrendszert elĹ‘fordĂtĂłkĂ©nt használunk a feldolgozott programozási nyelv kiterjesztĂ©sĂ©re. UtĂłbbi mĂłdszerrel könnyen implementálhatĂł az Erlang nyelvben a kĂłdmigráciĂł