A new architecture reconciling refactorings and transformations

IF 1.7 3区 计算机科学 Q3 COMPUTER SCIENCE, SOFTWARE ENGINEERING
Balša Šarenac , Nicolas Anquetil , Stéphane Ducasse , Pablo Tesone
{"title":"A new architecture reconciling refactorings and transformations","authors":"Balša Šarenac ,&nbsp;Nicolas Anquetil ,&nbsp;Stéphane Ducasse ,&nbsp;Pablo Tesone","doi":"10.1016/j.cola.2024.101273","DOIUrl":null,"url":null,"abstract":"<div><p><em>Refactorings</em> are behavior-preserving code transformations. They are a recommended software development practice and are now a standard feature in modern IDEs. There are however many situations where developers need to perform mere <em>transformations</em> (non-behavior-preserving) or to mix refactorings and transformations. Little work exists on the analysis of transformations <em>implementation</em>, how refactorings could be composed of smaller, reusable, parts (simple transformations or other refactorings), and, conversely, how transformations could be <em>reused</em> in isolation or to compose new refactorings. In a previous article, we started to analyze the seminal implementation of refactorings as proposed in the Ph.D. of D. Roberts, and whose evolution is available in the Pharo IDE. We identified a dichotomy between the class hierarchy of <em>refactorings</em> (56 classes) and that of <em>transformations</em> (70 classes). We also noted that there are different kinds of preconditions for different purposes (applicability preconditions or behavior-preserving preconditions). In this article, we go further by proposing a new architecture that: (i) supports two important scenarios (interactive use or scripting, <em><em>i.e.,</em></em> batch use); (ii) defines a clear API unifying refactorings and transformations; (iii) expresses refactorings as decorators over transformations, and; (iv) formalizes the uses of the different kinds of preconditions, thus supporting better user feedback. We are in the process of migrating the existing Pharo refactorings to this new architecture. Current results show that elementary transformations such as the <span>Add Method</span> transformation is reused in 24 refactorings and 11 other transformations; and the <span>Remove Method</span> transformation is reused in 11 refactorings and 7 other transformations.</p></div>","PeriodicalId":48552,"journal":{"name":"Journal of Computer Languages","volume":"80 ","pages":"Article 101273"},"PeriodicalIF":1.7000,"publicationDate":"2024-05-31","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Journal of Computer Languages","FirstCategoryId":"94","ListUrlMain":"https://www.sciencedirect.com/science/article/pii/S2590118424000169","RegionNum":3,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q3","JCRName":"COMPUTER SCIENCE, SOFTWARE ENGINEERING","Score":null,"Total":0}
引用次数: 0

Abstract

Refactorings are behavior-preserving code transformations. They are a recommended software development practice and are now a standard feature in modern IDEs. There are however many situations where developers need to perform mere transformations (non-behavior-preserving) or to mix refactorings and transformations. Little work exists on the analysis of transformations implementation, how refactorings could be composed of smaller, reusable, parts (simple transformations or other refactorings), and, conversely, how transformations could be reused in isolation or to compose new refactorings. In a previous article, we started to analyze the seminal implementation of refactorings as proposed in the Ph.D. of D. Roberts, and whose evolution is available in the Pharo IDE. We identified a dichotomy between the class hierarchy of refactorings (56 classes) and that of transformations (70 classes). We also noted that there are different kinds of preconditions for different purposes (applicability preconditions or behavior-preserving preconditions). In this article, we go further by proposing a new architecture that: (i) supports two important scenarios (interactive use or scripting, i.e., batch use); (ii) defines a clear API unifying refactorings and transformations; (iii) expresses refactorings as decorators over transformations, and; (iv) formalizes the uses of the different kinds of preconditions, thus supporting better user feedback. We are in the process of migrating the existing Pharo refactorings to this new architecture. Current results show that elementary transformations such as the Add Method transformation is reused in 24 refactorings and 11 other transformations; and the Remove Method transformation is reused in 11 refactorings and 7 other transformations.

协调重构和转换的新架构
重构是一种行为保留代码转换。重构是一种推荐的软件开发实践,现在已成为现代集成开发环境的标准功能。然而,在许多情况下,开发人员需要执行单纯的转换(非行为保护),或将重构与转换混合使用。在分析转换实现、如何将重构由更小的、可重用的部分(简单转换或其他重构)组成,以及反过来,如何将转换单独重用或组成新的重构方面,目前还鲜有研究。在前一篇文章中,我们开始分析罗伯茨博士(D. Roberts)在其博士论文中提出的重构的开创性实现,Pharo集成开发环境也提供了该实现的演进。我们发现重构的类层次结构(56 个类)与转换的类层次结构(70 个类)之间存在二分法。我们还注意到,不同的目的有不同类型的前提条件(适用性前提条件或行为保留前提条件)。在本文中,我们进一步提出了一种新的架构,它可以(i) 支持两种重要场景(交互式使用或脚本,即批量使用);(ii) 定义了统一重构和转换的清晰 API;(iii) 将重构表达为转换的装饰器;(iv) 将不同类型前提条件的用途正规化,从而支持更好的用户反馈。我们正在将现有的 Pharo 重构移植到这个新架构中。目前的研究结果表明,基本变换(如添加方法变换)在 24 次重构和 11 次其他变换中被重复使用;删除方法变换在 11 次重构和 7 次其他变换中被重复使用。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
Journal of Computer Languages
Journal of Computer Languages Computer Science-Computer Networks and Communications
CiteScore
5.00
自引率
13.60%
发文量
36
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术官方微信