强规格有什么好处?
What Good Are Strong Specifications?
摘要:
轻量级形式化方法的经验表明,程序员愿意编写规范,如果它能给他们的日常开发活动带来切实的好处。本文考虑了更强的规范,并研究了它们是否可以作为一种增量实践来部署,从而带来额外的好处,而不会带来不可接受的昂贵成本。我们引入了一种方法,扩展了契约式设计,以先决条件,后置条件和不变量的形式编写功能属性的强规范。该方法的目的是让那些不熟悉正式技术但对编写简单规范感到舒适的开发人员感到满意。我们评估的成本和使用强规格的好处,通过应用该方法来测试数据结构实现写在Eiffel和C#。在我们广泛的实验中,针对强规范的测试检测到的bug是标准合约的两倍,在测试时的注释负担和运行时性能方面具有合理的开销。在广泛的软件质量形式化技术中,针对强规范的测试是一个“甜蜜点”,具有有利的收益与努力之比。
英文摘要:
Experience with lightweight formal methods suggests that programmers are willing to write specification if it brings tangible benefits to their usual development activities. This paper considers stronger specifications and studies whether they can be deployed as an incremental practice that brings additional benefits without being unacceptably expensive. We introduce a methodology that extends Design by Contract to write strong specifications of functional properties in the form of preconditions, postconditions, and invariants. The methodology aims at being palatable to developers who are not fluent in formal techniques but are comfortable with writing simple specifications. We evaluate the cost and the benefits of using strong specifications by applying the methodology to testing data structure implementations written in Eiffel and C#. In our extensive experiments, testing against strong specifications detects twice as many bugs as standard contracts, with a reasonable overhead in terms of annotation burden and run-time performance while testing. In the wide spectrum of formal techniques for software quality, testing against strong specifications lies in a "sweet spot" with a favorable benefit to effort ratio.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。