Good documentation offers the promise of enabling developers to easily understand design decisions. Unfortunately, in practice, design documents are often rarely updated, becoming inaccurate, incomplete, and untrustworthy. A better solution is to enable developers to write down design rules which are checked against code for consistency. But existing rule checkers require learning specialized query languages or program analysis frameworks, creating a barrier to writing project-specific rules. We introduce two new techniques for authoring design rules: snippet-based authoring and semi-natural-language authoring. In snippet-based authoring, developers specify characteristics of elements to match by writing partial code snippets. In semi-natural language authoring, a textual representation offers a representation for understanding design rules and resolving ambiguities. We implemented these approaches in RulePad. To evaluate RulePad, we conducted a between-subjects study with 14 participants comparing RulePad to the PMD Designer, a utility for writing rules in a popular rule checker. We found that those with RulePad were able to successfully author 13 times more query elements in significantly less time and reported being significantly more willing to use RulePad in their everyday work.
翻译:良好的文件提供了让开发者能够轻松理解设计决定的希望。 不幸的是,在实践中,设计文件往往很少更新,变得不准确、不完整和不可信。更好的解决办法是使开发者能够根据一致性守则来写下设计规则。但是,现有的规则核对器需要学习专门查询语言或程序分析框架,从而给编写项目特定规则制造障碍。我们引入了两种设计规则的写作新技术:基于片段的作者和半自然语言的作者。在片段的作者中,设计者通过撰写部分代码片段来指定要匹配元素的特性。在半自然语言的作者中,文本代表器提供了理解设计规则和解决模糊问题的代表。我们在《规则》中实施了这些方法。为了评估《规则》,我们与14名参与者进行了一项主题间研究,将规则Pad与PMD设计器进行比较,这是在流行规则检查器中写成规则的效用。我们发现,有规则Pad的人能够成功地撰写13倍的查询要素,但报告在日常工作中更愿意使用规则。