嵌套IF公式的自动重构
Automated Refactoring of Nested-IF Formulae in Spreadsheets
摘要:
电子表格是最受欢迎的终端用户编程软件,其中公式就像程序一样,也有气味。电子表格公式的一个公认的共同气味是嵌套IF表达式,其可读性低,用户认知成本高,并且在重用或维护期间容易出错。然而,最终用户通常缺乏必要的程序设计语言知识和技能来解决甚至意识到问题。以前的研究工作在这方面做了非常初步的尝试,而目前还没有有效的自动化方法。本文首先提出了一种基于AST的自动化方法来系统地重构嵌套IF公式。总的想法是双重的。首先,我们检测并删除AST上的逻辑冗余。其次,我们确定了更高层次的语义已经支离破碎,分散,并重新组装语法使用简洁的内置函数。一个全面的评估已经进行了对现实世界的电子表格语料库,这是收集在一家领先的IT公司的研究目的。对68,000多个电子表格和2700万个nest-IF公式的结果表明,我们的方法能够消除超过99%的nest-IF公式的气味。超过50%的重构将嵌套IF的嵌套级别减少了一半以上。此外,一项涉及49名参与者的调查表明,在大多数情况下,参与者更喜欢重构公式,并同意这种自动重构方法是必要的和有用的。
英文摘要:
Spreadsheets are the most popular end-user programming software, where formulae act like programs and also have smells. One well recognized common smell of spreadsheet formulae is nest-IF expressions, which have low readability and high cognitive cost for users, and are error-prone during reuse or maintenance. However, end users usually lack essential programming language knowledge and skills to tackle or even realize the problem. The previous research work has made very initial attempts in this aspect, while no effective and automated approach is currently available. This paper firstly proposes an AST-based automated approach to systematically refactoring nest-IF formulae. The general idea is two-fold. First, we detect and remove logic redundancy on the AST. Second, we identify higher-level semantics that have been fragmented and scattered, and reassemble the syntax using concise built-in functions. A comprehensive evaluation has been conducted against a real-world spreadsheet corpus, which is collected in a leading IT company for research purpose. The results with over 68,000 spreadsheets with 27 million nest-IF formulae reveal that our approach is able to relieve the smell of over 99\% of nest-IF formulae. Over 50% of the refactorings have reduced nesting levels of the nest-IFs by more than a half. In addition, a survey involving 49 participants indicates that for most cases the participants prefer the refactored formulae, and agree on that such automated refactoring approach is necessary and helpful.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。