一句话:提出 2Rx,自动将传统异步代码重构为响应式编程风格。
异步应用的实现与维护历来容易出错,而响应式编程语言与库(如 ReactiveX)以声明式风格显著改善代码清晰度与可扩展性,已在工业界广泛采用。然而大量既有软件仍基于传统异步抽象编写。本文提出 2Rx,一种自动重构方法,可将异步代码转换为响应式编程形式,从而在不重写系统的前提下获得响应式设计的收益。作者在 GitHub 高星项目上进行评估,结果表明 2Rx 能有效处理最常见的异步构造:覆盖了 12.7% 的含异步计算项目,并为其中 91.7% 的异步出现位置成功给出重构。
Reactive programming languages and libraries, such as ReactiveX, have been shown to significantly improve software design and have seen important industrial adoption over the last years. Asynchronous applications - which are notoriously error-prone to implement and to maintain - greatly benefit from reactive programming because they can be defined in a declarative style, which improves code clarity and extensibility. In this paper, we tackle the problem of refactoring existing software that has been designed with traditional abstractions for asynchronous programming. We propose 2Rx, a refactoring approach to automatically convert asynchronous code to reactive programming. Our evaluation on top-starred GitHub projects shows that 2Rx is effective with the most common asynchronous constructs, covering 12.7% of projects with asynchronous computations, and it can provide a refactoring for 91.7% of their occurrences.
DOI 原文 ·
@inproceedings{paperbot5305,
title = {Automated Refactoring to Reactive Programming},
author = {Mirko Kohler and Guido Salvaneschi},
booktitle = {ASE},
year = {2019},
doi = {10.1109/ase.2019.00082}
}