3,869 research outputs found

    Refactoring Functional Programs

    Get PDF
    Refactoring is the process of redesigning existing code without changing its functionality. Refactoring has recently come to prominence in the OO community. In this paper we explore the prospects for refactoring functional programs. Our paper centres on the case study of refactoring a 400 line Haskell program written by one of our students. The case study illustrates the type and variety of program manipulations involved in refactoring. Similarly to other program transformations, refactorings are based on program equivalences, and thus ultimately on language semantics. In the context of functional languages, refactorings can be based on existing theory and program analyses. However, the use of program transformations for program restructuring emphasises a different kind of transformation from the more traditional derivation or optimisation: characteristically, they often require wholesale changes to a collection of modules, and although they are best controlled by programmers, their application may require nontrivial semantic analyses. The paper also explores the background to refactoring, provides a taxonomy for describing refactorings and draws some conclusions about refactoring for functional programs

    Evolution of Model Transformations by Model Refactoring: Long Version

    Get PDF
    Model-to-model transformations between visual languages are often defined by typed, attributed graph transformation systems. Here, the source and target languages of the model transformation are given by type graphs (or meta models), and the relation between source and target model elements is captured by graph transformation rules. On the other hand, refactoring is a technique to improve the structure of a model in order to make it easier to comprehend, more maintainable and amenable to change. Refactoring can be defined by graph transformation rules, too. In the context of model transformation, problems arise when models of the source language of a model transformation become subject to refactoring. It may well be the case that after the refactoring, the model transformation rules are no longer applicable because the refactoring induced structural changes in the models. In this paper, we consider a graph-transformation-based evolution of model transformations which adapts the model transformation rules to the refactored models. In the main result, we show that under suitable assumptions, the evolution leads to an adapted model transformation which is compatible with refactoring of the source and target models. In a small case study, we apply our techniques to a well-known model transformation from statecharts to Petri nets

    Refactoring of Model Transformations

    Get PDF
    Model-to-model transformations between visual languages are often defined by typed, attributed graph transformation systems. Here, the source and target languages of the model transformation are given by type graphs (or meta models), and the relation between source and target model elements is captured by graph transformation rules. On the other hand, refactoring is a technique to improve the structure of a model in order to make it easier to comprehend, more maintainable and amenable to change. Refactoring can be defined by graph transformation rules, too. In the context of model transformation, problems arise when models of the source language of a model transformation become subject to refactoring. It may well be the case that after the refactoring, the model transformation rules are no longer applicable because the refactoring induced structural changes in the models. In this paper, we consider a graph-transformation-based evolution of model transformations which adapts the model transformation rules to the refactored models. In the main result, we show that under suitable assumptions, the evolution leads to an adapted model transformation which is compatible with refactoring of the source and target models. In a small case study, we apply our techniques to a well-known model transformation from statecharts to Petri nets

    Transformation in HaRe

    Get PDF
    HaRe [?] is a system developed at the University of Kent Computing Laboratory to support refactoring in Haskell. We also want HaRe to be an open platform to support general Haskell program transformation so it can be used by other researchers in the field. This paper demonstrates the facilities HaRe provides for program transformation by implementing a deforestation transformation as a case study

    Renaming Global Variables in C Mechanically Proved Correct

    Get PDF
    Most integrated development environments are shipped with refactoring tools. However, their refactoring operations are often known to be unreliable. As a consequence, developers have to test their code after applying an automatic refactoring. In this article, we consider a refactoring operation (renaming of global variables in C), and we prove that its core implementation preserves the set of possible behaviors of transformed programs. That proof of correctness relies on the operational semantics of C provided by CompCert C in Coq.Comment: In Proceedings VPT 2016, arXiv:1607.0183

    A Model Driven Approach for Refactoring Heterogeneous Software Artefacts

    Get PDF
    Refactoring is the process of transforming a software system to improve its overall structure while preserving its observable behaviour. Refactoring engines are normally used to perform these transformations for efficiency and in order to avoid introducing behavioural changes into the program due to human error. Although these engines do not verify that behaviour is preserved, it is widely accepted that automated transformations are less likely to introduce errors in comparison to manual refactoring. Despite the advantages provided by refactoring engines they fall foul of certain weaknesses. Here we hypothesise that Model Driven Engineering can be used to produce improved refactoring engines that are less vulnerable to those weaknesses. We develop a Domain Specific Transformation Language for defining new composite refactorings from a set of built–in primitives and to script their application. We also develop an interpreter for the language, effectively providing an operational semantics, in the guise of an extensible transformation framework. We evaluate our approach with a case study examining the correlation between actual and predicted measurements of the Coupling Between Objects metric for classes that undergo the extract class refactoring. The results show that our approach is promising

    Improving Prolog Programs: Refactoring for Prolog

    Full text link
    Refactoring is an established technique from the OO-community to restructure code: it aims at improving software readability, maintainability and extensibility. Although refactoring is not tied to the OO-paradigm in particular, its ideas have not been applied to Logic Programming until now. This paper applies the ideas of refactoring to Prolog programs. A catalogue is presented listing refactorings classified according to scope. Some of the refactorings have been adapted from the OO-paradigm, while others have been specifically designed for Prolog. Also the discrepancy between intended and operational semantics in Prolog is addressed by some of the refactorings. In addition, ViPReSS, a semi-automatic refactoring browser, is discussed and the experience with applying \vipress to a large Prolog legacy system is reported. Our main conclusion is that refactoring is not only a viable technique in Prolog but also a rather desirable one.Comment: To appear in ICLP 200
    corecore