计算机工程与应用 ›› 2013, Vol. 49 ›› Issue (14): 51-55.

• 理论研究、研发设计 • 上一篇    下一篇

基于用况图的程序理解方法研究

司海平1,乔红波1,虎晓红1,陈宝钢1,曹永生2   

  1. 1.河南农业大学 信息与管理科学学院,郑州 450002
    2.中国农业科学院 作物科学研究所,北京 100081
  • 出版日期:2013-07-15 发布日期:2013-07-31

Study on program comprehension method based on use case diagram

SI Haiping1, QIAO Hongbo1, HU Xiaohong1, CHEN Baogang1, CAO Yongsheng2   

  1. 1.College of Information and Management Science, Henan Agricultural University, Zhengzhou 450002, China
    2.Institute of Crop Science, Chinese Academy of Agricultural Sciences, Beijing 100081, China
  • Online:2013-07-15 Published:2013-07-31

摘要: 用况图从用户的角度描述了系统需求,是表达系统功能的有效方式。如果能从系统源代码中直接抽象程序的用况图,对于程序理解工作将具有很大的帮助。基于此理念,提出了基于用况图的辅助用户程序理解方法。该方法通过静态分析把源代码抽象为树型图表达结构,通过度量计算树型图中各类结点值并生成带权的树型图,根据设定的阈值对该图进行剪裁来控制程序复杂度,通过对剪裁后的树型图进行遍历形成系统的执行路径集合,抽象为最终的候选用况。在图形化工具的辅助支持下从候选用况中抽象出系统的用况图,实验分析取得良好效果。

关键词: 静态分析, 软件工程, 用况图, 程序理解

Abstract: Use case diagram is an effective way to express system functions from the perspective of the user, which is often used to describe system demands. If use case diagram of program can be abstracted from the system source code directly, that will be of great help for user to understand program. Based on this idea, a reverse engineering method to enhance program comprehension for user is designed in this paper. A tree graph express structure of source codes is abstracted by using the static analysis method. By setting metric value of the nodes of the tree graph, the weighted tree diagram can be generated. According to the metric it sets, the nodes of the tree graph can be clipped, which controls program complexity. Execution paths of the software, which are the candidates of use cases, are obtained by traversing the clipped tree graph. With the help of graphic tool, use case diagrams can be abstracted from the candidates of use cases, and experimental analysis has gained good effects.

Key words: static analysis, software engineering, use case diagram, program comprehension