计算机应用 ›› 2020, Vol. 40 ›› Issue (10): 3025-3033.DOI: 10.11772/j.issn.1001-9081.2020030311

• 计算机软件技术 • 上一篇    下一篇

基于控制流的软件设计与实现一致性分析方法

张家奇, 牟永敏, 张志华   

  1. 网络文化与数字传播北京市重点实验室(北京信息科技大学), 北京 100101
  • 收稿日期:2020-03-18 修回日期:2020-05-27 出版日期:2020-10-10 发布日期:2020-06-10
  • 通讯作者: 张家奇
  • 作者简介:张家奇(1995-),男,山西临汾人,硕士研究生,主要研究方向:软件测试;牟永敏(1961-),男,山东烟台人,教授,博士,主要研究方向:软件测试、大数据;张志华(1971-),女,黑龙江宝清人,副教授,硕士,主要研究方向:软件测试、计算机软件。
  • 基金资助:
    网络文化与数字传播北京市重点实验室开放课题(5221935409)。

Consistency analysis method of software design and implementation based on control flow

ZHANG Jiaqi, MU Yongmin, ZHANG Zhihua   

  1. Beijing Key Laboratory of Internet Culture and Digital Dissemination Research(Beijing Information Science and Technology University), Beijing 100101, China
  • Received:2020-03-18 Revised:2020-05-27 Online:2020-10-10 Published:2020-06-10
  • Supported by:
    This work is partially supported by the Open Project of Beijing Key Laboratory of Internet Culture and Digital Dissemination Research (5221935409).

摘要: 针对目前软件设计与实现一致性检测方法需要大量模板集,难以一般化的问题,提出一种基于控制流的软件设计与实现一致性分析方法。首先,将设计文档伪代码和程序源代码转换为具有相同特征的中间表示,从中间表示中分别提取设计特征和实现特征,特征包括能反映系统结构的函数调用关系和能反映函数内部结构的控制流信息;然后,根据设计特征和实现特征分别建立设计特征模型和实现特征模型;最后,通过计算特征相似度来度量特征模型的相似度,进而获取一致性检测结果。实验结果表明,所提方法在软件实现的函数调用关系与设计不一致时,能够正确检测不一致函数调用关系;而在软件实现的函数调用关系与设计一致时,能够正确检测函数内部结构的不一致情况,准确度达到了92.85%。该方法可以有效获取一致性检测结果,不需要模板集,具有更优越的一般性。

关键词: 控制流, 函数特征, 函数调用, 伪代码, 一致性检测

Abstract: The current consistency detection methods of software design and implementation require a large number of template sets and are difficult to generalize. In order to solve these problems, a consistency analysis method of software design and implementation based on control flow was proposed. Firstly, the pseudocode of the design document and the source code of the program were converted into the intermediate representations with the same features, and the design feature and the implementation feature were respectively extracted from the intermediate representations. The features include the function call relationship which can reflect the system structure and the control flow information which can reflect the internal structure of the function. Then, the design feature model and the implementation feature model were respectively established according to the design feature and the implementation feature. Finally, the similarity of the feature model was measured by calculating the feature similarity, so as to obtain the consistency detection result. Experimental results show that this method can correctly detect the inconsistent function call relationship when the function call relationship realized by the software is inconsistent with the design, and can correctly detect the inconsistency of the internal structure of the function when the function call relationship realized by the software is consistent with the design, with the accuracy reached 92.85%. This method can effectively obtain the consistency detection results without any template set, and has superior generality.

Key words: control flow, function feature, function call, pseudocode, consistency detection

中图分类号: