JP7029915B2 - Source code analyzer and source code analysis method - Google Patents

Source code analyzer and source code analysis method Download PDF

Info

Publication number
JP7029915B2
JP7029915B2 JP2017184915A JP2017184915A JP7029915B2 JP 7029915 B2 JP7029915 B2 JP 7029915B2 JP 2017184915 A JP2017184915 A JP 2017184915A JP 2017184915 A JP2017184915 A JP 2017184915A JP 7029915 B2 JP7029915 B2 JP 7029915B2
Authority
JP
Japan
Prior art keywords
graph
program
program element
source code
software
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
JP2017184915A
Other languages
Japanese (ja)
Other versions
JP2019061438A (en
Inventor
正恭 加藤
誠 市井
真澄 川上
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hitachi Solutions Ltd
Original Assignee
Hitachi Solutions Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hitachi Solutions Ltd filed Critical Hitachi Solutions Ltd
Priority to JP2017184915A priority Critical patent/JP7029915B2/en
Publication of JP2019061438A publication Critical patent/JP2019061438A/en
Application granted granted Critical
Publication of JP7029915B2 publication Critical patent/JP7029915B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Stored Programmes (AREA)

Description

本発明は、ソースコード解析装置およびソースコード解析方法に係り、特に、ソフトウェア開発におけるソースコードにおける保守性を低下させる要因の有無を解析するのに好適なソースコード解析装置およびソースコード解析方法に関する。 The present invention relates to a source code analysis device and a source code analysis method, and more particularly to a source code analysis device and a source code analysis method suitable for analyzing the presence or absence of factors that reduce maintainability in source code in software development.

近年のソフトウェア開発では、開発済みの母体ソフトウェアを拡張または変更することによって新しいソフトウェアを開発する派生開発が主流である。ソフトウェアの派生開発においては、長年に渡る機能拡張または変更の繰り返しにより、ソフトウェアが複雑化し、ソースコードの可読性が低下しやすい。このような状況を解決するため、ソフトウェアのリファクタリング(refactoring)が一般的に行われている。リファクタリングとは、ソフトウェアの振る舞いを変えず、その内部構造を改善していくことである。保守性が低い関数、クラス、ファイルなどのプログラム構成要素(以下、「プログラム要素」という)を適切にリファクタリングすれば、ソフトウェアが拡張または変更しやすくなる。 In recent software development, derivative development that develops new software by extending or modifying the developed parent software is the mainstream. In the development of derivative software, the readability of the source code tends to decrease due to the complexity of the software due to repeated enhancements or changes over many years. Software refactoring is commonly used to solve this situation. Refactoring is to improve the internal structure of software without changing its behavior. Appropriate refactoring of program components (hereinafter referred to as "program elements") such as functions, classes, and files that are not maintainable makes it easier for software to extend or change.

リファクタリングにおける重要な概念として、「アンチパターン」がある。アンチパターンとは、保守性が低いプログラム要素が持つ特徴(以下、「問題特徴」という)と、当該問題特徴を持つプログラム要素のリファクタリング方法のパターンをまとめたものである。リファクタリング対象ソフトウェアにおいて、アンチパターンが示すような問題特徴を持つプログラム要素を特定できれば、アンチパターンを適用することでリファクタリングすることができる。 An important concept in refactoring is "anti-patterns". An anti-pattern is a collection of features of a program element with low maintainability (hereinafter referred to as "problem feature") and a pattern of refactoring method of the program element having the problem feature. In the software to be refactored, if a program element having a problem characteristic as shown by the anti-pattern can be identified, it can be refactored by applying the anti-pattern.

例えば、特許文献1には、ソースコード、構成管理システムまたは稼動ログからメトリクスを計測し、ソースコードのアンチパターン該当可否を評価する手法が記載されている。これにより、リファクタリングが必要ない複雑なソースコードを抽出せず、真にリファクタリングが必要なソースコードを特定することができる。 For example, Patent Document 1 describes a method of measuring metrics from a source code, a configuration management system, or an operation log and evaluating whether or not an anti-pattern of the source code is applicable. This makes it possible to identify source code that truly needs refactoring without extracting complex source code that does not require refactoring.

特開2016-143107号公報Japanese Unexamined Patent Publication No. 2016-143107

上記特許文献1に記載されている手法では、ソースコードをプログラム解析して得られるプログラム要素の特徴量(以下、「ソフトウェアメトリクス」という)を用いて、当該プログラム要素が問題特徴を備えているか否かを判定している。しかしながら、アンチパターンが示す問題特徴の中には、ソフトウェアメトリクスを用いるだけではプログラム要素が当該問題特徴を備えているか否かを判定しづらいものがある。ここでは、そのような以下、Shotgun surgeryおよびThe Blobという二つのアンチパターンを例に採って説明する。 In the method described in Patent Document 1, whether or not the program element has problematic features by using the feature amount of the program element obtained by program analysis of the source code (hereinafter referred to as "software metric"). Is determined. However, among the problem features shown by anti-patterns, it is difficult to determine whether or not a program element has the problem features only by using software metrics. Here, two such anti-patterns, Shotgun surgery and The Blob, will be described as an example.

Shotgun surgeryは、当該プログラム要素を拡張または変更すると多くの他のプログラム要素も同時に拡張または変更されるという問題特徴を持つプログラム要素をリファクタリングするためのパターンである。Shotgun surgeryが示す問題特徴は、プログラム要素そのものの特徴ではなく、プログラム要素の変更に関する特徴であるため、ソフトウェアメトリクスを用いて当該問題特徴を持つプログラム要素を特定するのは難しい。 Shotgun surgery is a pattern for refactoring a program element that has the problem feature that when the program element is extended or changed, many other program elements are also extended or changed at the same time. Since the problem characteristics shown by Shotgun surgery are not the characteristics of the program element itself but the characteristics related to the change of the program element, it is difficult to identify the program element having the problem characteristic by using software metrics.

The Blobは、複数の機能が1箇所にまとめて実装されているという問題特徴を持つプログラム要素をリファクタリングするためのパターンである。The Blobが示す問題特徴を持つプログラム要素は、大規模化または複雑化する傾向があるため、その特定には、プログラム要素の規模または複雑度というソフトウェアメトリクスが有効である。しかしながら、単一の機能が実装されたプログラム要素でも規模や複雑度が大きくなる場合はあるため、判定結果にはノイズが載りやすく、判定結果に信頼性が欠けがちになるという傾向がある。一方で、The Blobが示す問題特徴を持つプログラム要素は、当該プログラム要素が実装する複数の機能が拡張または変更されるたびに併せて拡張または変更される場合が多く、The Blobに対処することは特に重要な課題になることが多い。 The Blob is a pattern for refactoring program elements that have the problematic feature that multiple functions are implemented together in one place. Since the program elements with the problematic characteristics shown by The Blob tend to be large or complicated, the software metric of the scale or complexity of the program elements is effective for identifying them. However, since the scale and complexity of a program element in which a single function is implemented may increase, noise tends to appear in the judgment result, and the judgment result tends to lack reliability. On the other hand, a program element with the problematic characteristics indicated by The Blob is often expanded or changed at the same time when multiple functions implemented by the program element are expanded or changed, and it is not possible to deal with The Blob. Often it is a particularly important issue.

リファクタリングを適切におこなうためには、プログラム要素の変更をどうように管理するかが特に重要である。しかしながら、上記特許文献1に記載の技術では、アンチパターンが示す問題特徴をプログラム要素が備えているか否かを判定するためには、ソフトウェアメトリクスを考慮しているが、プログラム要素の変更に関する情報については考慮されていない。 How to manage changes in program elements is especially important for proper refactoring. However, in the technique described in Patent Document 1, software metrics are taken into consideration in order to determine whether or not the program element has the problematic feature indicated by the anti-pattern. Is not considered.

本発明の目的は、プログラム要素が問題特徴を備えているか否かを、プログラム要素の変更履歴を用いて判定し、解析結果を表示するソースコード解析装置を提供することにある。 An object of the present invention is to provide a source code analysis device that determines whether or not a program element has a problem feature by using a change history of the program element and displays an analysis result.

本発明のソースコード解析装置の構成は、好ましくは、解析対象のプログラムのソースコードの保守性に関する問題を指摘するソースコード解析装置であって、解析対象のプログラムの変更履歴と、プログラムの変更に関する指標の閾値を入力して、プログラム要素の変更依存関係ルールを出力するロジカルカップリング分析部と、変更依存関係ルールに基づいて、プログラム要素をノード、変更前のプログラム要素のノードから変更後のプログラム要素のノードに向けた有向辺として、プログラム要素の変更依存関係を表現したロジカルカップリンググラフを生成するロジカルカップリング生成部と、生成されたロジカルカップリンググラフと、プログラム要素毎に定められたグラフパラメータに関する情報に基づいて、ロジカルカップリンググラフにおいて保守性の低いプログラム要素を検出して、保守性の低いプログラム要素のノードを強調したアンチパターングラフとするアンチパターン検出部と、アンチパターングラフを表示するアンチパターン表示部とからなるようにしたものである。 The configuration of the source code analysis device of the present invention is preferably a source code analysis device that points out a problem regarding the maintainability of the source code of the program to be analyzed, and is related to the change history of the program to be analyzed and the change of the program. The logical coupling analysis unit that inputs the threshold value of the index and outputs the change dependency rule of the program element, and the program element after the change from the node of the program element before the change and the node of the program element before the change based on the change dependency rule. As the directed side toward the node of the element, the logical coupling generator that generates the logical coupling graph expressing the change dependency of the program element, the generated logical coupling graph, and the generated logical coupling graph are defined for each program element. An anti-pattern detector that detects a program element with low maintainability in a logical coupling graph based on information about graph parameters and makes it an anti-pattern graph that emphasizes the nodes of the program element with low maintainability, and an anti-pattern graph. It consists of an anti-pattern display unit to be displayed.

本発明によれば、プログラム要素が問題特徴を備えているか否かを、プログラム要素の変更履歴を用いて判定し、解析結果を表示するソースコード解析装置を提供することができる。 According to the present invention, it is possible to provide a source code analysis device that determines whether or not a program element has a problem feature by using a change history of the program element and displays an analysis result.

実施形態1のソースコード解析装置の機能構成を示すブロック図である。It is a block diagram which shows the functional structure of the source code analysis apparatus of Embodiment 1. FIG. 実施形態1のソースコード解析装置のハードウェア・ソフトウェア構成を示すブロック図である。It is a block diagram which shows the hardware software structure of the source code analysis apparatus of Embodiment 1. FIG. プログラム要素変更履歴の一例を示す図である。It is a figure which shows an example of the program element change history. バスケット解析閾値テーブルの一例を示す図である。It is a figure which shows an example of the basket analysis threshold table. 変更依存関係ルールテーブルの一例を示す図である。It is a figure which shows an example of the change dependency rule table. ロジカルカップリンググラフの一例を示す図である。It is a figure which shows an example of a logical coupling graph. グラフパターンマッチロジックの一例を示す図である。It is a figure which shows an example of the graph pattern matching logic. 実施形態1のプログラム要素情報の一例を示す図である。It is a figure which shows an example of the program element information of Embodiment 1. FIG. グラフパラメータ閾値の一例を示す図である。It is a figure which shows an example of a graph parameter threshold value. 実施形態1のパラメータ論理式の一例を示す図である。It is a figure which shows an example of the parameter logical expression of Embodiment 1. FIG. 実施形態1のアンチパターングラフの一例を示す図である。It is a figure which shows an example of the anti-pattern graph of Embodiment 1. FIG. The Blobのアンチパターングラフの一例を示す図である。It is a figure which shows an example of the anti-pattern graph of The Blob. Shotgun surgeryのアンチパターングラフの一例を示す図である。It is a figure which shows an example of the anti-pattern graph of Shotgun surgery. ロジカルカップリング分析部の処理を示すフローチャートである。It is a flowchart which shows the process of a logical coupling analysis part. 実施形態1のロジカルカップリンググラフ生成部の処理を示すフローチャートである。It is a flowchart which shows the process of the logical coupling graph generation part of Embodiment 1. 図15のS1303のロジカルカップリンググラフ生成処理を示すフローチャートである。It is a flowchart which shows the logical coupling graph generation process of S1303 of FIG. 図15のS1304のプログラム要素情報の生成処理を示すフローチャートである。It is a flowchart which shows the generation process of the program element information of S1304 of FIG. アンチパターン検出部の処理を説明するフローチャートである。It is a flowchart explaining the process of the anti-pattern detection part. 実施形態2のソースコード解析装置の機能構成を示すブロック図である。It is a block diagram which shows the functional structure of the source code analysis apparatus of Embodiment 2. 実施形態2のソースコード解析装置のハードウェア・ソフトウェア構成を示すブロック図である。It is a block diagram which shows the hardware software configuration of the source code analysis apparatus of Embodiment 2. ソフトウェアメトリクス取得ロジックの一例を示す図である。It is a figure which shows an example of the software metric acquisition logic. ソフトウェアメトリクス情報の一例を示す図である。It is a figure which shows an example of software metric information. 実施形態2のプログラム要素情報の一例を示す図である。It is a figure which shows an example of the program element information of Embodiment 2. ソフトウェアメトリクス閾値テーブルの一例を示す図である。It is a figure which shows an example of a software metrics threshold table. 実施形態2のパラメータ論理式の一例を示す図である。It is a figure which shows an example of the parameter logical expression of Embodiment 2. 実施形態2のアンチパターングラフの一例を示す図である。It is a figure which shows an example of the anti-pattern graph of Embodiment 2. プログラム解析部の処理を説明するフローチャートである。It is a flowchart explaining the process of a program analysis part. 実施形態2のロジカルカップリンググラフ生成部の処理を説明するフローチャートである。It is a flowchart explaining the process of the logical coupling graph generation part of Embodiment 2. 図28のS1304のプログラム要素情報の生成処理を示すフローチャートである。It is a flowchart which shows the generation process of the program element information of S1304 of FIG. 実施形態3のソースコード解析装置の機能構成を示すブロック図である。It is a block diagram which shows the functional structure of the source code analysis apparatus of Embodiment 3. 実施形態3のソースコード解析装置のハードウェア・ソフトウェア構成を示すブロック図である。It is a block diagram which shows the hardware software configuration of the source code analysis apparatus of Embodiment 3. システムパラメータ更新画面を示す図である。It is a figure which shows the system parameter update screen.

以下、本発明に係る各実施形態を、図1ないし図32を用いて説明する。 Hereinafter, each embodiment of the present invention will be described with reference to FIGS. 1 to 32.

〔実施形態1〕
以下、本発明の実施形態1を、図1ないし図18を用いて説明する。
先ず、図1および図2を用いて実施形態1のソースコード解析装置の構成について説明する。
[Embodiment 1]
Hereinafter, Embodiment 1 of the present invention will be described with reference to FIGS. 1 to 18.
First, the configuration of the source code analysis apparatus of the first embodiment will be described with reference to FIGS. 1 and 2.

ソースコード解析装置10は、図1に示すように、ロジカルカップリング分析部101と、ロジカルカップリンググラフ生成部103と、アンチパターン検出部104と、情報記憶部105、アンチパターン表示部119の各機能部を備える。 As shown in FIG. 1, the source code analysis device 10 includes a logical coupling analysis unit 101, a logical coupling graph generation unit 103, an anti-pattern detection unit 104, an information storage unit 105, and an anti-pattern display unit 119. It has a functional part.

これらの機能は、例えば、プロセッサ11が、主記憶装置12や補助記憶装置13に格納されているプログラムを読み出して実行することにより実現される。またこれらの機能は、例えば、ソースコード解析装置10が備えるハードウェア(ASIC(Application Specific Integrated Circuit)等)によって実現される。 These functions are realized, for example, by the processor 11 reading and executing a program stored in the main storage device 12 and the auxiliary storage device 13. Further, these functions are realized by, for example, hardware (ASIC (Application Specific Integrated Circuit) or the like) included in the source code analysis device 10.

情報記憶部105は、変更依存関係ルールテーブル114と、ロジカルカップリンググラフ116と、プログラム要素情報117を、補助記憶装置13に記憶する。情報記憶部105は、これらの情報以外にも、ロジカルカップリング分析部101や、ロジカルカップリンググラフ生成部103や、アンチパターン検出部104が適宜参照もしくは生成する情報等を記憶する。情報記憶部105は、補助記憶装置13に記憶する情報を、例えば、ファイルシステムやDBMS(DataBase Management System)によって管理する。なお、これらのデータについての具体例は後に詳述する。 The information storage unit 105 stores the change dependency rule table 114, the logical coupling graph 116, and the program element information 117 in the auxiliary storage device 13. In addition to these information, the information storage unit 105 stores information such as information that is appropriately referred to or generated by the logical coupling analysis unit 101, the logical coupling graph generation unit 103, and the anti-pattern detection unit 104. The information storage unit 105 manages the information stored in the auxiliary storage device 13 by, for example, a file system or a DBMS (DataBase Management System). Specific examples of these data will be described in detail later.

ロジカルカップリング分析部101は、ソースコード解析にあたって、解析対象となるソースコードのプログラム要素変更履歴106と、バスケット解析閾値テーブル107を受け付けて、変更依存関係ルールテーブル114を生成する機能部である。 The logical coupling analysis unit 101 is a functional unit that receives the program element change history 106 of the source code to be analyzed and the basket analysis threshold table 107 and generates the change dependency rule table 114 in the source code analysis.

ロジカルカップリンググラフ生成部103は、変更依存関係ルールテーブル114と、グラフパターンマッチロジックを受け付けて、ロジカルカップリンググラフ116およびプログラム要素情報117を生成する機能部である。 The logical coupling graph generation unit 103 is a functional unit that receives the change dependency rule table 114 and the graph pattern matching logic and generates the logical coupling graph 116 and the program element information 117.

アンチパターン検出部104は、ロジカルカップリンググラフ116と、上記プログラム要素情報117を受け付けて、アンチパターングラフ118を生成する機能部である。 The anti-pattern detection unit 104 is a functional unit that receives the logical coupling graph 116 and the program element information 117 and generates the anti-pattern graph 118.

アンチパターン表示部119は、アンチパターングラフ118を表示する機能部である。 The anti-pattern display unit 119 is a functional unit that displays the anti-pattern graph 118.

次に、図2を用いて実施形態1のソースコード解析装置のハードウェア・ソフトウェア構成について説明する。 Next, the hardware / software configuration of the source code analysis device of the first embodiment will be described with reference to FIG.

ソースコード解析装置10は、ソフトウェアシステムの開発や保守等に利用される情報処理装置(コンピュータ)である。ソースコード解析装置10は、クラウドシステムにより提供されるクラウドサーバ等のように仮想的に実現されるものであてもよい。 The source code analysis device 10 is an information processing device (computer) used for the development and maintenance of a software system. The source code analysis device 10 may be virtually realized such as a cloud server provided by a cloud system.

ソースコード解析装置10は、図2に示されるように、プロセッサ11、主記憶装置12、補助記憶装置13、入力装置14、出力装置15、通信装置16がバス5により接続され、互いに通信可能になっている。 As shown in FIG. 2, the source code analysis device 10 has a processor 11, a main storage device 12, an auxiliary storage device 13, an input device 14, an output device 15, and a communication device 16 connected by a bus 5 so as to be able to communicate with each other. It has become.

プロセッサ11は、例えば、CPU(Central Processing Unit)やMPU(Micro Processing Unit)を用いて構成されている。プロセッサ11が、主記憶装置12に格納されているプログラムを読み出して実行することにより、ソースコード解析装置10の様々な機能が実現される。主記憶装置12は、プログラムやデータを記憶する装置であり、例えば、ROM(Read Only Memory)、RAM(Random Access Memory)、不揮発性半導体メモリ(NVRAM(Non Volatile RAM))等である。 The processor 11 is configured by using, for example, a CPU (Central Processing Unit) or an MPU (Micro Processing Unit). When the processor 11 reads and executes the program stored in the main storage device 12, various functions of the source code analysis device 10 are realized. The main storage device 12 is a device for storing programs and data, and is, for example, a ROM (Read Only Memory), a RAM (Random Access Memory), a non-volatile semiconductor memory (NVRAM (Non Volatile RAM)), and the like.

補助記憶装置13は、例えば、HDD(Hard Disk Drive:ハードディスクドライブ)、SSD(Solid State Drive)、光学式記憶装置(CD(Compact Disc)、DVD(Digital Versatile Disc)等)、ストレージシステム、ICカード、SDメモリカードや光学式記録媒体等の記録媒体の読取/書込装置、クラウドサーバの記憶領域等である。補助記憶装置13に格納されているプログラムやデータは主記憶装置12に随時ロードされて、実行される。 The auxiliary storage device 13 includes, for example, an HDD (Hard Disk Drive), an SSD (Solid State Drive), an optical storage device (CD (Compact Disc), DVD (Digital Versatile Disc), etc.), a storage system, and an IC card. , A reading / writing device for a recording medium such as an SD memory card or an optical recording medium, a storage area for a cloud server, and the like. The programs and data stored in the auxiliary storage device 13 are loaded and executed in the main storage device 12 at any time.

本実施形態では、図示しないOS(Operating System)や各種ユーティリティのほか、ロジカルカップリング分析プログラム1301、ロジカルカップリンググラフ生成プログラム1302、アンチパターン検出プログラム1303、アンチパターン表示プログラム1304がインストールされている。ロジカルカップリング分析プログラム1301、ロジカルカップリンググラフ生成プログラム1302、アンチパターン検出プログラム1303、アンチパターン表示プログラム1304は、それぞれロジカルカップリング分析部101や、ロジカルカップリンググラフ生成部103や、アンチパターン検出部104、アンチパターン表示部119の各機能を実行するためのプログラムである。 In this embodiment, in addition to an OS (Operating System) and various utilities (not shown), a logical coupling analysis program 1301, a logical coupling graph generation program 1302, an anti-pattern detection program 1303, and an anti-pattern display program 1304 are installed. The logical coupling analysis program 1301, the logical coupling graph generation program 1302, the anti-pattern detection program 1303, and the anti-pattern display program 1304 are the logical coupling analysis unit 101, the logical coupling graph generation unit 103, and the anti-pattern detection unit, respectively. 104, a program for executing each function of the anti-pattern display unit 119.

また、補助記憶装置13は、プログラム要素変更履歴106と、バスケット解析閾値テーブル107、グラフパターンマッチロジック110、グラフパラメータ閾値テーブル112、パラメータ論理式113、変更依存関係ルールテーブル114、ロジカルカップリンググラフ116、プログラム要素情報117、アンチパターングラフ118を格納している。なお、各種データの詳細は後に詳述する。 Further, the auxiliary storage device 13 has a program element change history 106, a basket analysis threshold table 107, a graph pattern match logic 110, a graph parameter threshold table 112, a parameter logic expression 113, a change dependency rule table 114, and a logical coupling graph 116. , Program element information 117, and anti-pattern graph 118 are stored. The details of various data will be described in detail later.

入力装置14は、例えば、キーボード、マウス、タッチパネル、カードリーダ、音声入力装置等である。出力装置15は、ユーザに処理経過や処理結果等の各種情報を提供するユーザインターフェースを実現するための装置であり、例えば、画面表示装置(液晶モニタ:LCD(Liquid Crystal Display))、グラフィックカード、音声出力装置(スピーカ等)、印字装置等である。なお、例えば、ソースコード解析装置10が通信装置16を介して他の装置との間で情報の入力や出力を行う構成としてもよい。 The input device 14 is, for example, a keyboard, a mouse, a touch panel, a card reader, a voice input device, or the like. The output device 15 is a device for realizing a user interface that provides various information such as processing progress and processing results to the user, and is, for example, a screen display device (liquid crystal monitor: LCD (Liquid Crystal Display)), a graphic card, and the like. Audio output devices (speakers, etc.), printing devices, etc. In addition, for example, the source code analysis device 10 may be configured to input and output information to and from another device via the communication device 16.

通信装置16は、LANやインターネット等の通信手段を介した他の装置との間の通信を実現する有線方式または無線方式の通信インタフェースであり、例示すれば、NIC(Network Interface Card)、無線通信モジュール、USB(Universal Serial Interface)モジュール、シリアル通信モジュール等である。 The communication device 16 is a wired or wireless communication interface that realizes communication with other devices via a communication means such as LAN or the Internet. For example, a NIC (Network Interface Card) or wireless communication. Modules, USB (Universal Serial Interface) modules, serial communication modules, etc.

次に、図3ないし図13を用いて実施形態1のソースコード解析装置に使用されるデータ構造について説明する。 Next, the data structure used in the source code analysis apparatus of the first embodiment will be described with reference to FIGS. 3 to 13.

図3に示されるプログラム要素変更履歴106は、解析対象となるプログラムに発生した変更の履歴を、変更が発生するたびに変更履歴レコード303として記録したものである。変更履歴レコード303は、変更番号301と、以上の変更プログラム要素名302のフィールドで構成される。変更番号301は、当該変更履歴レコード303を識別するために一意に付与される識別子を格納するフィールドである。変更プログラム要素名302は、当該変更履歴レコード303に対応するプログラム変更発生時に同時変更された一つ以上の変更プログラム要素名を格納するフィールドである。プログラム要素とは、既に説明したように、関数、クラス、ファイルなどのプログラム構成要素である。 The program element change history 106 shown in FIG. 3 records the history of changes that have occurred in the program to be analyzed as the change history record 303 each time a change occurs. The change history record 303 is composed of a change number 301 and a field of the above change program element name 302. The change number 301 is a field for storing an identifier uniquely assigned to identify the change history record 303. The change program element name 302 is a field for storing one or more change program element names that have been changed at the same time when the program change corresponding to the change history record 303 occurs. Program elements are program components such as functions, classes, and files, as described above.

例えば、変更番号301が「1」の変更履歴レコード303に対応する変更発生時には、変更プログラム要素名302に記載された「プログラム要素A、プログラム要素B、プログラム要素C」のプログラム要素が同時変更されている。 For example, when a change corresponding to the change history record 303 in which the change number 301 is "1" occurs, the program elements of "program element A, program element B, program element C" described in the change program element name 302 are changed at the same time. ing.

プログラム要素変更履歴106には、例えば、解析対象となるプログラムをバージョン管理するバージョン管理システムの変更履歴情報を用いてもよい。この場合、一般的なバージョン管理システムではファイル単位でバージョン管理するため、解析対象となるプログラム要素の種類はファイルとなる。または、プログラム要素変更履歴106には、当該変更履歴情報をプログラム構造情報に基づいてクラス単位またはファイル単位の変更履歴情報に変換したものを用いてもよい。この場合、解析対象となるプログラム要素の種類はクラスまたはファイルとなる。
また、変更履歴として、プログラム要素の更新日付が加わっていてもよい。
For the program element change history 106, for example, the change history information of the version control system that manages the version of the program to be analyzed may be used. In this case, since version control is performed on a file-by-file basis in a general version control system, the type of program element to be analyzed is a file. Alternatively, the program element change history 106 may be converted from the change history information into change history information in class units or file units based on the program structure information. In this case, the type of program element to be analyzed is a class or a file.
Further, the update date of the program element may be added as the change history.

図4に示されるバスケット解析閾値テーブル107は、ロジカルカップリング分析部101でバスケット解析を行うときに用いる閾値を記録したものである。ここで、なお、「バスケット解析」とは、データ分析の用語であり、同時に変更されるプログラム要素を、スーパーマーケットなどにおけるバスケットの中の商品と見立てて名づけられたものである。バスケット解析閾値テーブル107は、ルール評価値名401、閾値402の各フィールドを有する。閾値402は、ルール評価値名401に記載されたルール評価値を評価するときの0以上1以下の閾値が格納される。 The basket analysis threshold table 107 shown in FIG. 4 records the thresholds used when performing basket analysis in the logical coupling analysis unit 101. Here, "basket analysis" is a term for data analysis, and is named by assuming that a program element that is changed at the same time is a product in a basket in a supermarket or the like. The basket analysis threshold table 107 has fields of the rule evaluation value name 401 and the threshold 402. The threshold value 402 stores a threshold value of 0 or more and 1 or less when evaluating the rule evaluation value described in the rule evaluation value name 401.

本実施形態のルール評価値には、支持度403、確信度404、リフト値405の三つがあり、それぞれに対して0以上1以下の閾値が記述されている。各々のルール評価値とその閾値の適用については、後に詳述する。 There are three rule evaluation values of the present embodiment, a support degree 403, a certainty degree 404, and a lift value 405, and a threshold value of 0 or more and 1 or less is described for each of them. The application of each rule evaluation value and its threshold value will be described in detail later.

図5に示される変更依存関係ルールテーブル114は、同時変更されやすいプログラム要素の順序対を変更依存関係ルールレコード504として記録したものである。変更依存関係ルールテーブル114は、ロジカルカップリング分析部101でバスケット解析を行った結果得られる情報を変更依存関係ルールとして、格納するテーブルである。 The change dependency rule table 114 shown in FIG. 5 records the ordered pair of program elements that are easily changed at the same time as the change dependency rule record 504. The change dependency rule table 114 is a table that stores information obtained as a result of performing basket analysis by the logical coupling analysis unit 101 as a change dependency rule.

ここで、プログラム要素の順序対の順序対は、順序対の一つ目のプログラム要素が変更されたときに、当該順序対の二つ目のプログラム要素も同時に変更されやすいというルールを表している。変更依存関係ルールレコード504は、ルール番号501と、変更対象プログラム要素名502と、同時変更プログラム要素名503の各フィールドを有する。 Here, the ordered pair of the ordered pair of program elements represents a rule that when the first program element of the ordered pair is changed, the second program element of the ordered pair is also likely to be changed at the same time. .. The change dependency rule record 504 has fields of rule number 501, change target program element name 502, and simultaneous change program element name 503.

ルール番号501は、当該変更依存関係ルールレコード504を識別するために一意に付与される識別子を格納する。変更対象プログラム要素名502は、プログラム要素の順序対における一つ目のプログラム要素を格納する。同時変更プログラム要素名503は、上記順序対における二つ目のプログラム要素を格納する。 Rule number 501 stores an identifier uniquely assigned to identify the change dependency rule record 504. The program element name 502 to be changed stores the first program element in the ordered pair of program elements. The simultaneous change program element name 503 stores the second program element in the above ordered pair.

変更依存関係ルールテーブル114は、ロジカルカップリング分析部101でバスケット解析を行う前にレコードが登録されていない状態に初期化されているものとする。 It is assumed that the change dependency rule table 114 is initialized to a state in which no record is registered before the basket analysis is performed by the logical coupling analysis unit 101.

図6に示されるロジカルカップリンググラフ116は、プログラム要素を頂点701とし、同時変更されやすいプログラム要素の順序対を有向辺702とした有向グラフである。このロジカルカップリンググラフ116は、ロジカルカップリンググラフ生成部103で作成され、出力装置15を用いてユーザに出力される。ユーザは、ロジカルカップリンググラフ116を見ることによって、プログラム要素間にどのような同時変更されやすい関係があるかを確認できる。ロジカルカップリンググラフ116は、ロジカルカップリンググラフ生成部103でロジカルカップリング作成処理を行う前に頂点と有向辺が登録されていない状態に初期化されているものとする。 The logical coupling graph 116 shown in FIG. 6 is a directed graph in which the program element is the vertex 701 and the ordered pair of the program elements that are easily changed at the same time is the directed side 702. The logical coupling graph 116 is created by the logical coupling graph generation unit 103, and is output to the user by using the output device 15. By looking at the logical coupling graph 116, the user can confirm what kind of simultaneous changeable relationship is between the program elements. It is assumed that the logical coupling graph 116 is initialized to a state in which the vertices and the directed edges are not registered before the logical coupling creation process is performed by the logical coupling graph generation unit 103.

図7に示されるグラフパターンマッチロジック110は、図6に示したロジカルカップリンググラフ116のグラフの頂点ごとに値が定まるグラフパラメータ値を取得するためのロジックを記録したものである。グラフパターンマッチロジック110は、取得したいグラフパラメータ値の種類ごとに作成され、グラフパラメータ名601とグラフパターンマッチロジック本体602で構成される。グラフパラメータ名601は、グラフの特徴を表すパラメータであり、例えば、有向グラフの頂点の入次数、出次数である。また、グラフパラメータとは、一般的にグラフ理論で定義されるような他の値を用いてもよい。グラフパターンマッチロジック本体602は、独自の論理記述言語を用いてもよいし、実行可能なプログラミング言語やスクリプトで記述してもよい。 The graph pattern matching logic 110 shown in FIG. 7 records a logic for acquiring a graph parameter value in which a value is determined for each vertex of the graph of the logical coupling graph 116 shown in FIG. The graph pattern matching logic 110 is created for each type of graph parameter value to be acquired, and is composed of a graph parameter name 601 and a graph pattern matching logic main body 602. The graph parameter name 601 is a parameter representing the characteristics of the graph, and is, for example, the input degree and the output degree of the vertices of the directed graph. Further, as the graph parameter, other values generally defined by graph theory may be used. The graph pattern matching logic body 602 may use its own logic description language, or may be described by an executable programming language or script.

図8に示されるプログラム要素情報117は、プログラム要素ごとに、図6に示したロジカルカップリンググラフ116の頂点701に関するグラフパラメータ値を記録したものである。プログラム要素情報117は、プログラム要素ごとに作成され、プログラム要素名801、当該プログラム要素に対応するパラメータテーブル802で構成される。パラメータテーブル802は、パラメータレコード805毎に、グラフパラメータ名803、パラメータ値804の各フィールドを有する。グラフパラメータ名803には、グラフパターンマッチロジック110で定義されたグラフパラメータ名が格納される。パラメータ値804は、グラフパラメータ名803に対応するパラメータの値が格納される。パラメータ値804の値には、図7に示した対応するグラフパターンマッチロジック110で定義されたグラフパターンマッチロジック本体602を用いて取得したグラフパラメータ値が記録される。このプログラム要素情報117は、出力装置15を用いてユーザに出力される。ユーザは、プログラム要素情報117を見ることによって、プログラム要素に対応するグラフ要素がどのようなグラフパラメータ値を持つかを確認できる。プログラム要素情報117は、ロジカルカップリンググラフ生成部103でプログラム要素情報作成処理を行う前に、未作成状態に初期化されているものとする。 The program element information 117 shown in FIG. 8 records the graph parameter values for the vertices 701 of the logical coupling graph 116 shown in FIG. 6 for each program element. The program element information 117 is created for each program element, and is composed of a program element name 801 and a parameter table 802 corresponding to the program element. The parameter table 802 has each field of the graph parameter name 803 and the parameter value 804 for each parameter record 805. The graph parameter name 803 stores the graph parameter name defined by the graph pattern matching logic 110. The parameter value 804 stores the value of the parameter corresponding to the graph parameter name 803. In the value of the parameter value 804, the graph parameter value acquired by using the graph pattern matching logic main body 602 defined by the corresponding graph pattern matching logic 110 shown in FIG. 7 is recorded. This program element information 117 is output to the user using the output device 15. By looking at the program element information 117, the user can confirm what kind of graph parameter value the graph element corresponding to the program element has. It is assumed that the program element information 117 is initialized to the uncreated state before the program element information creation process is performed by the logical coupling graph generation unit 103.

図9に示されるグラフパラメータ閾値テーブル112は、グラフパターンマッチロジック110で定義したグラフパラメータ名601に対し、当該パラメータ値が異常であると判断するための閾値をグラフパラメータ閾値レコード905として記録したテーブルである。グラフパラメータ閾値レコード905は、グラフパラメータ識別子901と、グラフパラメータ名902と、グラフパラメータ閾値903と、グラフパラメータ判定条件904のフィールドで構成される。 The graph parameter threshold table 112 shown in FIG. 9 is a table in which a threshold value for determining that the parameter value is abnormal is recorded as a graph parameter threshold record 905 for the graph parameter name 601 defined by the graph pattern match logic 110. Is. The graph parameter threshold record 905 is composed of a graph parameter identifier 901, a graph parameter name 902, a graph parameter threshold value 903, and a field of graph parameter determination condition 904.

グラフパラメータ識別子901には、当該グラフパラメータ閾値レコード905を識別するために一意に付与される識別子が格納される。グラフパラメータ名902には、グラフパラメータの名称が格納される。グラフパラメータ閾値903には、異常であると判断するための閾値が格納される。グラフパラメータ判定条件904には、例えば、グラフパラメータに対応するグラフパラメータ値がグラフパラメータ閾値903と比べてどんな値をとる場合に異常とみなすかを判断するための判定条件が格納される。 The graph parameter identifier 901 stores an identifier uniquely assigned to identify the graph parameter threshold record 905. The name of the graph parameter is stored in the graph parameter name 902. The graph parameter threshold value 903 stores a threshold value for determining an abnormality. The graph parameter determination condition 904 stores, for example, a determination condition for determining what value the graph parameter value corresponding to the graph parameter takes as compared with the graph parameter threshold value 903 to be regarded as abnormal.

ここで、グラフパラメータ判定条件904には、グラフパラメータ値とグラフパラメータ閾値903を比較するための関係演算子を記述している。なお、グラフパラメータ値をグラフパラメータ判定条件904およびグラフパラメータ閾値903を用いて評価した結果を、当該グラフパラメータ値に対する判定結果という。 Here, the graph parameter determination condition 904 describes a relational operator for comparing the graph parameter value and the graph parameter threshold value 903. The result of evaluating the graph parameter value using the graph parameter determination condition 904 and the graph parameter threshold value 903 is referred to as a determination result for the graph parameter value.

図10に示されるパラメータ論理式113は、複数のパラメータ値に対する判定結果を総合的に評価して、当該パラメータ値の組が異常であるか否かを判断するための論理式である。パラメータ論理式113は、論理学で用いられる一般的な文字や記号を用いて記述し、一般的な推論規則によってその真偽値が評価可能であるとする。例えば、パラメータ論理式113は、グラフパラメータ識別子901、論理演算記号(&または|)、括弧記号((または))などを用いて記述する。ここで、グラフパラメータ閾値テーブル112のグラフパラメータ識別子901の真偽値は、当該グラフパラメータ値804に対する判定結果とし、グラフパラメータ識別子901を原始論理式として論理演算記号を用いて得られる論理式の真偽値は、論理学の一般的な推論規則に従うものとする。 The parameter logical formula 113 shown in FIG. 10 is a logical formula for comprehensively evaluating the determination results for a plurality of parameter values and determining whether or not the set of the parameter values is abnormal. The parameter formula 113 is described using general characters and symbols used in logic, and its truth value can be evaluated by a general inference rule. For example, the parameter logical formula 113 is described using a graph parameter identifier 901, a logical operation symbol (& or |), a parenthesis symbol ((or)), and the like. Here, the truth value of the graph parameter identifier 901 in the graph parameter threshold table 112 is the true / false value of the logical expression obtained by using the logical operation symbol with the graph parameter identifier 901 as the primitive logical expression as the determination result for the graph parameter value 804. False values shall follow the general rules of reasoning in logic.

図10に示される例では、グラフパラメータ閾値テーブル112のグラフパラメータ識別子901の表す論理式G1,G2に対し、G1またはG2であるときに、真であることを示している。すなわち、これは、(グラフパラメータA≧4)OR(グラフパラメータB≧6)でとるときに、真であることを意味している。 In the example shown in FIG. 10, it is shown that the logical expressions G1 and G2 represented by the graph parameter identifier 901 in the graph parameter threshold table 112 are true when they are G1 or G2. That is, this means that it is true when taken with (graph parameter A ≧ 4) OR (graph parameter B ≧ 6).

図11に示されるアンチパターングラフ118は、ロジカルカップリンググラフ116の頂点701において、特に問題特徴を有する頂点703を強調的に表現したものである。ロジカルカップリンググラフ116の頂点701が問題特徴を有する頂点703か否かは、当該頂点703に対応するプログラム要素のプログラム要素情報117に記録されたパラメータ値804およびグラフパラメータ閾値テーブル112を用いて、パラメータ論理式113で定義した方法によって評価した真偽値により判断する。ここで、当該真偽値が真である場合は、当該頂点は問題特徴を有する頂点703であり、当該真偽値が偽である場合は、当該頂点は問題特徴を有する頂点703であると判断する。問題特徴を有する頂点703の表現方法としては、当該頂点を着色または発光または点滅または拡大などの手法を採用してもよい。アンチパターングラフ118は、アンチパターン表示部119によって、出力装置15を用いてユーザに出力される。ユーザは、アンチパターングラフ118を見ることによって、プログラム要素間にどのような同時変更されやすい関係があるかを確認できる。 The anti-pattern graph 118 shown in FIG. 11 emphasizes the vertex 703 having a problematic feature in the vertex 701 of the logical coupling graph 116. Whether or not the vertex 701 of the logical coupling graph 116 is the vertex 703 having the problem feature is determined by using the parameter value 804 and the graph parameter threshold table 112 recorded in the program element information 117 of the program element corresponding to the vertex 703. Judgment is made based on the truth value evaluated by the method defined in the parameter logical expression 113. Here, if the truth value is true, it is determined that the vertex is a vertex 703 having a problem feature, and if the truth value is false, it is determined that the vertex is a vertex 703 having a problem feature. do. As a method of expressing the vertex 703 having the problem feature, a method such as coloring, emitting light, blinking, or enlarging the vertex may be adopted. The anti-pattern graph 118 is output to the user by the anti-pattern display unit 119 using the output device 15. By looking at the anti-pattern graph 118, the user can see what kind of simultaneous changeable relationships are between the program elements.

ここで、例として採り上げたThe Blobのアンチパターングラフの一例を示すと、図12に示されるようになる。頂点703aの入次数が極端に大きくなっている。すなわち、頂点703aの示すプログラム要素が複数の機能が1箇所にまとめて実装されているという問題特徴を有することを意味している。 Here, an example of the anti-pattern graph of The Blob taken as an example is shown in FIG. The degree of the vertex 703a is extremely large. That is, it means that the program element indicated by the vertex 703a has a problem feature that a plurality of functions are collectively implemented in one place.

また、Shotgun surgeryのアンチパターングラフの一例を示すと、図13に示されるようになる。頂点703bの出次数が極端に大きくなっている。すなわち、頂点703bの示すプログラム要素が当該プログラム要素を拡張または変更すると多くの他のプログラム要素も同時に拡張または変更されるという問題特徴を有することを意味している。 Further, an example of an anti-pattern graph of Shotgun surgery is shown in FIG. The order of the vertices 703b is extremely large. That is, it means that the program element indicated by the vertex 703b has a problem feature that when the program element is expanded or changed, many other program elements are also expanded or changed at the same time.

次に、図14ないし図18を用いて実施形態1のソースコード解析装置の処理について説明する。 Next, the processing of the source code analysis apparatus of the first embodiment will be described with reference to FIGS. 14 to 18.

先ず、図14を用いてロジカルカップリング分析部101の処理について説明する。
先ず、ロジカルカップリング分析部101は、図3に示したプログラム要素変更履歴106を読み込む(S1201)。次に、バスケット解析閾値テーブル107を読み込む(S1202)。
First, the processing of the logical coupling analysis unit 101 will be described with reference to FIG.
First, the logical coupling analysis unit 101 reads the program element change history 106 shown in FIG. 3 (S1201). Next, the basket analysis threshold table 107 is read (S1202).

ロジカルカップリング分析部101は、読み込んだプログラム要素変更履歴106からプログラム要素の全ての順序対を生成し、各順序対(E1,E2)に対して以下のS1203~S1209の処理を実施する(S1203)。 The logical coupling analysis unit 101 generates all ordered pairs of program elements from the read program element change history 106, and executes the following processes S1203 to S1209 for each ordered pair (E1, E2) (S1203). ).

順序対(E1,E2)に対する支持度を計算する(S1204)。ここで、順序対(E1,E2)に対する支持度とは、プログラム要素E1とE2の同時変更されやすさを表す0以上1以下の値であり、E1とE2を変更プログラム要素名302に含む変更履歴レコード303の数を全ての変更履歴レコード303の数で割った値である。 The degree of support for ordered pairs (E1, E2) is calculated (S1204). Here, the support degree for the ordered pair (E1, E2) is a value of 0 or more and 1 or less indicating the ease of simultaneous change of the program elements E1 and E2, and the change including E1 and E2 in the change program element name 302. It is a value obtained by dividing the number of history records 303 by the number of all change history records 303.

すなわち、順序対(E1,E2)に対する支持度は、次の(式1)で表される値である。 That is, the degree of support for the ordered pair (E1, E2) is a value represented by the following (Equation 1).

Figure 0007029915000001
Figure 0007029915000001

次に、順序対(E1,E2)に対する確信度を計算する(S1205)。ここで、順序対(E1,E2)に対する確信度とは、プログラム要素E1が変更されたときのE2の変更されやすさを表す0以上1以下の値であり、E1とE2を変更プログラム要素名302に含む変更履歴レコード303の数を、E1を変更プログラム要素名302に含む変更履歴レコード303の数で割った値である。 Next, the conviction for the ordered pair (E1, E2) is calculated (S1205). Here, the conviction for the ordered pair (E1, E2) is a value of 0 or more and 1 or less indicating the ease of change of E2 when the program element E1 is changed, and E1 and E2 are changed program element names. It is a value obtained by dividing the number of change history records 303 included in 302 by the number of change history records 303 including E1 in the change program element name 302.

すなわち、順序対(E1,E2)に対する確信度は、次の(式2)で表される値である。 That is, the conviction for the ordered pair (E1, E2) is a value represented by the following (Equation 2).

Figure 0007029915000002
Figure 0007029915000002

順序対(E1,E2)に対するリフト値を計算する(S1206)。ここで、順序対(E1,E2)に対するリフト値とは、プログラム要素E1の変更とE2の変更の相関関係について、値が1の場合は無相関、1より大きい場合は正の相関、1より小さい場合は負の相関があることを表す0以上の値である。順序対(E1,E2)に対するリフト値は、次の(式3)で表される値である。 The lift value for the ordered pair (E1, E2) is calculated (S1206). Here, the lift value for the ordered pair (E1, E2) is uncorrelated when the value is 1 and positive correlation when the value is larger than 1, regarding the correlation between the change of the program element E1 and the change of E2. When it is small, it is a value of 0 or more indicating that there is a negative correlation. The lift value for the ordered pair (E1, E2) is a value represented by the following (Equation 3).

Figure 0007029915000003
Figure 0007029915000003

次に、順序対(E1,E2)に対する支持度、確信度、およびリフト値の全てが、バスケット解析閾値テーブル107で与えたそれぞれのルール評価値401の閾値402を超過しているか否かを判定する(S1207)。 Next, it is determined whether all of the support, certainty, and lift values for the ordered pair (E1, E2) exceed the threshold 402 of each rule evaluation value 401 given in the basket analysis threshold table 107. (S1207).

支持度、確信度、リフト値およびリフト値の全てが閾値を超過している場合には(S1207:YES)、図5に示した変更依存関係ルールテーブル114に、一意的なルール番号501を付与した新しい変更依存関係ルールレコード504を追加し、当該変更依存関係ルールレコード504の変更対象プログラム要素名502にプログラム要素E1を、同時変更プログラム要素名503にプログラム要素E2を記録する(S1208)。 When the support level, the certainty level, the lift value, and the lift value all exceed the threshold value (S1207: YES), the change dependency rule table 114 shown in FIG. 5 is given a unique rule number 501. The new change dependency rule record 504 is added, and the program element E1 is recorded in the change target program element name 502 of the change dependency rule record 504, and the program element E2 is recorded in the simultaneous change program element name 503 (S1208).

支持度、確信度、リフト値およびリフト値のいずれかが閾値を超過していない場合には(S1207:NO)、何もしない。
以上を、全ての順序対(E1,E2)に対して実施する(S1203~S1209)。
If any of the support, certainty, lift value, and lift value does not exceed the threshold value (S1207: NO), nothing is done.
The above is carried out for all ordered pairs (E1, E2) (S1203 to S1209).

次に、図15を用いてロジカルカップリンググラフ生成部103の処理について説明する。
先ず、ロジカルカップリンググラフ生成部103は、図5に示した変更依存関係ルールテーブル114を読み込む(S1301)。
次に、図7に示したグラフパターンマッチロジックを読み込む(S1302)。
次に、ロジカルカップリンググラフ生成処理をおこなう(S1303)。ロジカルカップリンググラフ生成処理は、サブルーチンとして、次に、図16を用いて説明する。
次に、プログラム要素情報生成処理をおこなう(S1304)。プログラム要素情報生成処理は、サブルーチンとして、後に、図17を用いて説明する。
Next, the processing of the logical coupling graph generation unit 103 will be described with reference to FIG.
First, the logical coupling graph generation unit 103 reads the change dependency rule table 114 shown in FIG. 5 (S1301).
Next, the graph pattern matching logic shown in FIG. 7 is read (S1302).
Next, a logical coupling graph generation process is performed (S1303). The logical coupling graph generation process will be described as a subroutine next with reference to FIG.
Next, the program element information generation process is performed (S1304). The program element information generation process will be described later as a subroutine with reference to FIG.

次に、図16を用いてロジカルカップリンググラフ生成処理(図15のS1303)について説明する。
ロジカルカップリンググラフ生成部103は、全てのプログラム要素Eに対して以下の処理を実施する(S1401~S1404)。図6に示したロジカルカップリンググラフ116に、プログラム要素Eに対応する頂点Nを追加する(S1402)。ロジカルカップリンググラフ生成部103は、頂点Nに対応する図8のプログラム要素情報117を作成し、プログラム要素名801にプログラム要素名としてプログラム要素Eを記録する(S1403)。
以上を、全てのプログラム要素Eに対して実施する(S1401~S1404)。
Next, the logical coupling graph generation process (S1303 in FIG. 15) will be described with reference to FIG.
The logical coupling graph generation unit 103 performs the following processing on all the program elements E (S1401 to S1404). Vertex N corresponding to the program element E is added to the logical coupling graph 116 shown in FIG. 6 (S1402). The logical coupling graph generation unit 103 creates the program element information 117 of FIG. 8 corresponding to the vertex N, and records the program element E as the program element name in the program element name 801 (S1403).
The above is carried out for all program elements E (S1401 to S1404).

次に、プログラム要素の全ての順序対(E1,E2)に対して以下の処理を実施する(S1405~S1407)。
次に、ロジカルカップリンググラフ116に、E1を始点、E2を終点とする有向辺を追加する(S1406)。
以上を、プログラム要素の全ての順序対(E1,E2)に対して実施する(S1405~S1407)。
Next, the following processing is performed for all ordered pairs (E1, E2) of the program elements (S1405 to S1407).
Next, a directed edge with E1 as the starting point and E2 as the ending point is added to the logical coupling graph 116 (S1406).
The above is carried out for all ordered pairs (E1, E2) of the program elements (S1405 to S1407).

次に、図17を用いてプログラム要素情報生成処理(図15のS1304)について説明する。
先ず、ロジカルカップリンググラフ116の全ての頂点Nに対して以下の処理を実施する(S1501~S1506)。
図7に示したグラフパターンマッチロジック110のグラフパターンマッチロジックLの全てに対して以下の処理を実施する(S1502~S1504)。
グラフパターンマッチロジックLのグラフパターンマッチロジック本体602を用いて、頂点NのグラフパターンマッチロジックLに対応するパラメータ値を取得する(S1503)。
以上を、全てのグラフパターンマッチロジックLに対して実施する(S1502~S1504)。
Next, the program element information generation process (S1304 in FIG. 15) will be described with reference to FIG.
First, the following processing is performed on all the vertices N of the logical coupling graph 116 (S1501 to S1506).
The following processing is performed on all of the graph pattern matching logic L of the graph pattern matching logic 110 shown in FIG. 7 (S1502 to S1504).
Using the graph pattern matching logic main body 602 of the graph pattern matching logic L, the parameter value corresponding to the graph pattern matching logic L of the vertex N is acquired (S1503).
The above is carried out for all graph pattern matching logic L (S1502 to S1504).

そして、頂点Nのグラフパラメータ値を頂点Nのプログラム要素情報117に追加する(S1505)。
以上を、ロジカルカップリンググラフの全ての頂点Nに対して実施する(S1501~S1506)。
Then, the graph parameter value of the vertex N is added to the program element information 117 of the vertex N (S1505).
The above is carried out for all the vertices N of the logical coupling graph (S1501 to S1506).

次に、図18を用いてアンチパターン検出部104の処理について説明する。
先ず、図10に示したパラメータ論理式113を読み込む(S1601)。
Next, the process of the anti-pattern detection unit 104 will be described with reference to FIG.
First, the parameter formula 113 shown in FIG. 10 is read (S1601).

次に、ロジカルカップリンググラフの全ての頂点Nに対して以下の処理を実施する(S1602~S1606)。
図8に示した頂点Nに対するプログラム要素情報117のグラフパラメータとその値、また、図9に示したグラフパラメータ閾値テーブルよりそのグラフパラメータの閾値、条件を読み込み、パラメータ論理式の真偽値を計算する(S1603)。そして、真偽値が真か偽かを判定する(S1604)。真偽値が真ならば(S1604:真)、アンチパターングラフ118における頂点Nを異常のあるプログラム要素に対応する頂点であるとして、強調表示するように設定する(S1605)。真偽値が偽ならば何もしない。これにより、頂点Nに対応するプログラム要素が問題特徴を有することが示されたことになる。
以上を、ロジカルカップリンググラフの全ての頂点Nに対して実施する(S1601~S1606)。
Next, the following processing is performed on all the vertices N of the logical coupling graph (S1602 to S1606).
The graph parameter and its value of the program element information 117 for the vertex N shown in FIG. 8 and the threshold value and condition of the graph parameter are read from the graph parameter threshold table shown in FIG. 9, and the truth value of the parameter logical formula is calculated. (S1603). Then, it is determined whether the truth value is true or false (S1604). If the truth value is true (S1604: true), the vertex N in the anti-pattern graph 118 is set to be highlighted as a vertex corresponding to the abnormal program element (S1605). If the boolean value is false, do nothing. This indicates that the program element corresponding to the vertex N has a problem feature.
The above is carried out for all the vertices N of the logical coupling graph (S1601 to S1606).

このように、問題特徴を有するプログラム要素をアンチパターングラフ118における問題特徴を有する頂点703として可視化することによって、アンチパターンが示す問題特徴をプログラム要素が備えているか否かをプログラム要素の変更履歴に基づき判定することができる。 In this way, by visualizing the program element having the problem feature as the vertex 703 having the problem feature in the anti-pattern graph 118, whether or not the program element has the problem feature indicated by the anti-pattern is shown in the change history of the program element. It can be determined based on.

〔実施形態2〕
以下、本発明の実施形態2を、図19ないし図29を用いて説明する。
[Embodiment 2]
Hereinafter, Embodiment 2 of the present invention will be described with reference to FIGS. 19 to 29.

実施形態1では、アンチパターングラフを生成するための問題特徴を有するプログラム要素の特定を、プログラム要素の変更履歴によりおこなった。
本実施形態は、それに加えて、問題特徴を有するプログラム要素の特定を、ソフトウェアメトリクスにも基づいておこなおうとするものである。本実施形態では、実施形態1と異なる所を中心に説明する。
In the first embodiment, the program element having the problematic feature for generating the anti-pattern graph is specified by the change history of the program element.
In addition to that, the present embodiment attempts to identify a program element having a problematic feature based on software metrics. In this embodiment, the points different from those in the first embodiment will be mainly described.

先ず、図19および図20を用いて実施形態2のソースコード解析装置の構成について説明する。
ロック図である。
本実施形態のソースコード解析装置10は、図19に示すように、図1に示した実施形態1の場合に加えて、プログラム解析部102を備える。
First, the configuration of the source code analysis apparatus of the second embodiment will be described with reference to FIGS. 19 and 20.
It is a lock diagram.
As shown in FIG. 19, the source code analysis device 10 of the present embodiment includes a program analysis unit 102 in addition to the case of the first embodiment shown in FIG.

情報記憶部105は、実施形態1の場合に加えて、ソフトウェアメトリクス情報115を、補助記憶装置13に記憶する。情報記憶部105は、これらの情報以外にも、プログラム解析部102部が適宜参照もしくは生成する情報等を記憶する。 In addition to the case of the first embodiment, the information storage unit 105 stores the software metric information 115 in the auxiliary storage device 13. In addition to these information, the information storage unit 105 stores information and the like that are appropriately referred to or generated by the program analysis unit 102.

ソフトウェアメトリクスとは、既に説明したように、ソースコードをプログラム解析して得られるプログラム要素の特徴量であり、具体的には、ソースコードの複雑度、ソースコードのステップ数、ソースコードの保守容易性指数、関数やサブルーチンの引数の個数、ソースコードに埋め込むコメントの割合などが考えられる。 As already explained, software metrics are the feature quantities of program elements obtained by program analysis of source code. Specifically, the complexity of source code, the number of steps in source code, and the ease of maintenance of source code. The sex index, the number of arguments of functions and subroutines, the ratio of comments to be embedded in the source code, etc. can be considered.

ソースコード解析装置10は、実施形態1の場合に加えて、プログラム解析部102を具備しており、ソースコード解析にあたって、プログラム解析部102は、解析対象となるソースコード108と、ソフトウェアメトリクス取得ロジック109を受け付けて、ソフトウェアメトリクス情報115を生成する。また、ロジカルカップリンググラフ生成部103は、実施形態1の場合に加えて、ソフトウェアメトリクス情報115を受け付けて、ソフトウェアメトリクスに関する情報を含むプログラム要素情報117を生成する。また、アンチパターン検出部104は、実施形態1の場合に加えて、ソフトウェアメトリクス閾値テーブル111を受け付けて、ソフトウェアメトリクスも考慮したアンチパターングラフ118を生成する。 In addition to the case of the first embodiment, the source code analysis device 10 includes a program analysis unit 102, and in source code analysis, the program analysis unit 102 includes a source code 108 to be analyzed and software metrics acquisition logic. It accepts 109 and generates software metric information 115. Further, in addition to the case of the first embodiment, the logical coupling graph generation unit 103 receives the software metric information 115 and generates the program element information 117 including the information about the software metric. Further, the anti-pattern detection unit 104 accepts the software metric threshold table 111 and generates an anti-pattern graph 118 in consideration of the software metric, in addition to the case of the first embodiment.

ロジカルカップリング分析部101の動作は、実施形態1の場合と同じである。
また、アンチパターン検出部104の動作は、実施形態1の場合と同じである。
The operation of the logical coupling analysis unit 101 is the same as that of the first embodiment.
Further, the operation of the anti-pattern detection unit 104 is the same as that of the first embodiment.

次に、図20を用いて実施形態2のソースコード解析装置のハードウェア・ソフトウェア構成について説明する。
本実施形態のソースコード解析装置10は、実施形態1のソースコード解析装置10とハードウェア構成は同一である。
Next, the hardware / software configuration of the source code analysis apparatus of the second embodiment will be described with reference to FIG.
The source code analysis device 10 of the present embodiment has the same hardware configuration as the source code analysis device 10 of the first embodiment.

補助記憶装置13には、実施形態1のプログラムに加えて、プログラム解析プログラム1305がインストールされている。プログラム解析プログラム1305は、プログラム解析部102の機能を実行するプログラムである。 In addition to the program of the first embodiment, the program analysis program 1305 is installed in the auxiliary storage device 13. The program analysis program 1305 is a program that executes the function of the program analysis unit 102.

また、補助記憶装置13には、実施形態1のデータに加えて、ソースコード108、ソフトウェアメトリクス取得ロジック109、ソフトウェアメトリクス情報115が格納されている。これらのデータの詳細は後述する。 Further, in the auxiliary storage device 13, in addition to the data of the first embodiment, the source code 108, the software metric acquisition logic 109, and the software metric information 115 are stored. Details of these data will be described later.

次に、図21ないし図26を用いて実施形態2のソースコード解析装置に使用されるデータ構造について説明する。
図21に示されるソフトウェアメトリクス取得ロジック109は、プログラム要素ごとに値が定まるソフトウェアメトリクス値を取得するためのロジックを記録したものである。ソフトウェアメトリクス取得ロジック109は、取得したいソフトウェアメトリクス値の種類ごとに作成され、ソフトウェアメトリクス名1801およびソフトウェアメトリクス取得ロジック本体1802で構成される。ここで、ソフトウェアメトリクス名1801には、プログラム要素の規模や複雑度などの、一般的にプログラム解析で評価されるような値を用いてもよい。また、ソフトウェアメトリクス取得ロジック本体1802は、独自の論理記述言語を用いてもよいし、実行可能なプログラミング言語やスクリプトで記述してもよい。
Next, the data structure used in the source code analysis apparatus of the second embodiment will be described with reference to FIGS. 21 to 26.
The software metric acquisition logic 109 shown in FIG. 21 records the logic for acquiring the software metric value whose value is determined for each program element. The software metric acquisition logic 109 is created for each type of software metric value to be acquired, and is composed of a software metric name 1801 and a software metric acquisition logic main body 1802. Here, the software metric name 1801 may be a value that is generally evaluated by program analysis, such as the scale and complexity of program elements. Further, the software metric acquisition logic main body 1802 may use its own logic description language, or may be described by an executable programming language or script.

図22に示されるソフトウェアメトリクス情報115は、ソフトウェアメトリクス取得ロジック109で定義したソフトウェアメトリクスのプログラム要素ごとの値をメトリクスレコード1903として記録したものである。メトリクスレコード1903は、プログラム要素名1901と、ソフトウェアメトリクス値1902のフィールドからなる。 The software metric information 115 shown in FIG. 22 records the value of each program element of the software metric defined in the software metric acquisition logic 109 as a metric record 1903. The metric record 1903 consists of a field with a program element name 1901 and a software metric value 1902.

プログラム要素名1901には、メトリクス取得対象のプログラム要素の名称が格納される。ソフトウェアメトリクス値1902には、ソフトウェアメトリクス取得ロジック109で定義したソフトウェアメトリクス名1901ごとのソフトウェアメトリクス値が格納される。 The program element name 1901 stores the name of the program element for which the metric is to be acquired. The software metric value 1902 stores the software metric value for each software metric name 1901 defined by the software metric acquisition logic 109.

ソフトウェアメトリクス情報115は、プログラム解析部102でプログラム解析を行う前にメトリクスレコード1903が登録されていない状態に初期化されているものとする。 It is assumed that the software metric information 115 is initialized to a state in which the metric record 1903 is not registered before the program analysis unit 102 performs the program analysis.

図23に示されるプログラム要素情報117は、実施形態1に加えて、ソフトウェアメトリクスに関する情報を考慮したものである。プログラム要素情報117には、実施形態1の場合に加えて、プログラム要素に関するソフトウェアメトリクス値1904を、当該プログラム要素に対応するプログラム要素情報117のパラメータテーブル802のパラメータレコード805として記録する。 The program element information 117 shown in FIG. 23 takes into account information about software metrics in addition to the first embodiment. In the program element information 117, in addition to the case of the first embodiment, the software metric value 1904 relating to the program element is recorded as the parameter record 805 of the parameter table 802 of the program element information 117 corresponding to the program element.

プログラム要素情報117は、出力装置15を用いてユーザに出力される。ユーザは、プログラム要素情報117を見ることによって、プログラム要素がどのようなソフトウェアメトリクスを持つかを確認できる。 The program element information 117 is output to the user by using the output device 15. The user can confirm what kind of software metrics the program element has by looking at the program element information 117.

図24に示されるソフトウェアメトリクス閾値テーブル111は、ソフトウェアメトリクス情報115に記録されたソフトウェアメトリクス名1902に対し、当該ソフトウェアメトリクス値1904が異常であると判断するための閾値をソフトウェアメトリクス閾値レコード2105として記録したものである。ソフトウェアメトリクス閾値レコード2105は、ソフトウェアメトリクス識別子2101と、ソフトウェアメトリクス名2102と、ソフトウェアメトリクス閾値2103と、ソフトウェアメトリクス判定条件2104のフィールドからなる。 The software metric threshold table 111 shown in FIG. 24 records the threshold value for determining that the software metric value 1904 is abnormal with respect to the software metric name 1902 recorded in the software metric information 115 as the software metric threshold record 2105. It was done. The software metric threshold record 2105 includes fields of a software metric identifier 2101, a software metric name 2102, a software metric threshold 2103, and a software metric determination condition 2104.

ソフトウェアメトリクス識別子2101には、当該ソフトウェアメトリクス閾値レコード2105を識別するために一意に付与される識別子が格納される。ソフトウェアメトリクス名2102には、当該ソフトウェアメトリクスの名称が格納される。ソフトウェアメトリクス閾値2103には、当該ソフトウェアメトリクスに対応する閾値が格納される。ソフトウェアメトリクス判定条件2104には、ソフトウェアメトリクス値1904がソフトウェアメトリクス閾値2103と比べてどんな値をとる場合に異常とみなすかを判断するための条件が格納される。 The software metric identifier 2101 stores an identifier uniquely assigned to identify the software metric threshold record 2105. The software metric name 2102 stores the name of the software metric. The software metric threshold 2103 stores the threshold value corresponding to the software metric. The software metric determination condition 2104 stores a condition for determining what value the software metric value 1904 takes as compared with the software metric threshold value 2103 to be regarded as abnormal.

ここで、ソフトウェアメトリクス判定条件2104には、例えば、ソフトウェアメトリクス値1904とソフトウェアメトリクス閾値2103を比較するための関係演算子を記述する。なお、ソフトウェアメトリクス値1904をソフトウェアメトリクス判定条件2104およびソフトウェアメトリクス閾値2103を用いて評価した結果を、当該ソフトウェアメトリクス値に対する判定結果という。 Here, in the software metric determination condition 2104, for example, a relational operator for comparing the software metric value 1904 and the software metric threshold value 2103 is described. The result of evaluating the software metric value 1904 using the software metric determination condition 2104 and the software metric threshold value 2103 is referred to as a determination result for the software metric value.

図25に示されるパラメータ論理式113は、実施形態1に加えてソフトウェアメトリクスに関する情報を考慮したものである。 The parameter formula 113 shown in FIG. 25 takes into account information about software metrics in addition to Embodiment 1.

パラメータ論理式113には、実施形態1の場合に加えて、ソフトウェアメトリクス識別子2101などを用いて記述してもよい。ここで、ソフトウェアメトリクス識別子2101の真偽値は、当該ソフトウェアメトリクス値804に対する判定結果とし、ソフトウェアメトリクス識別子2101を原始論理式として論理演算記号を用いて得られる論理式の真偽値は、論理学の一般的な推論規則に従うものとする。 In addition to the case of the first embodiment, the parameter logical expression 113 may be described by using the software metric identifier 2101 or the like. Here, the truth value of the software metric identifier 2101 is the determination result for the software metric value 804, and the truth value of the logical expression obtained by using the logical operation symbol with the software metric identifier 2101 as the primitive logical formula is the logic. It shall follow the general reasoning rules of.

図25に示される例では、ソフトウェアメトリクス閾値テーブル111のソフトウェアメトリクス識別子2101の表す論理式S1と、グラフパラメータ閾値テーブル112(実施形態1と同じ)のグラフパラメータ識別子901の表す論理式G1,G2に対し、S1かつ(G1またはG2)であるときに、真であることを示している。すなわち、これは、(ソフトウェアメトリクスA<25)AND((グラフパラメータA≧4)OR(グラフパラメータB≧6))でとるときに、真であることを意味している。 In the example shown in FIG. 25, the logical formula S1 represented by the software metric identifier 2101 of the software metric threshold table 111 and the logical formulas G1 and G2 represented by the graph parameter identifier 901 of the graph parameter threshold table 112 (same as the first embodiment) are used. On the other hand, when it is S1 and (G1 or G2), it indicates that it is true. That is, this means that it is true when taken by (software metric A <25) AND ((graph parameter A ≧ 4) OR (graph parameter B ≧ 6)).

図26に示されるアンチパターングラフ118は、ソフトウェアメトリクスに関する情報を考慮したものである。アンチパターングラフ118では、実施形態1では問題特徴を有する頂点703であった頂点の一部が通常の頂点702になっている。これは、グラフパラメータ値に対する判定結果に加えてソフトウェアメトリクス値に対する判定結果も考慮して、プログラム要素が問題特徴を持つか否かを判定したためである。グラフパラメータ値に対する判定結果では当該プログラム要素が問題特徴を持つと判定されていたのが、ソフトウェアメトリクス値に対する判定結果では当該プログラム要素が問題特徴を持たないと判定され、そのようなプログラム要素は問題特徴を有する頂点703ではなく通常の頂点702になっている。 The anti-pattern graph 118 shown in FIG. 26 takes into account information about software metrics. In the anti-pattern graph 118, some of the vertices that were the vertices 703 having the problematic feature in the first embodiment are the normal vertices 702. This is because it is determined whether or not the program element has a problem feature by considering the determination result for the software metric value in addition to the determination result for the graph parameter value. In the judgment result for the graph parameter value, it was judged that the program element had a problem feature, but in the judgment result for the software metric value, it was judged that the program element did not have the problem feature, and such a program element was a problem. It is a normal vertex 702 instead of a characteristic vertex 703.

次に、図27ないし図29を用いて実施形態2のソースコード解析装置の処理について説明する。
先ず、プログラム解析部102は、ソースコード108を読み込む(S2401)。
次に、ソフトウェアメトリクス取得ロジック109を読み込む(S2402)。
次に、全てのプログラム要素Eに対して以下の処理を実施する(S2403~S2408)。
次に、全てのソフトウェアメトリクス取得ロジックLに対して以下の処理を実施する(S2406~S2404)。
Next, the processing of the source code analysis apparatus of the second embodiment will be described with reference to FIGS. 27 to 29.
First, the program analysis unit 102 reads the source code 108 (S2401).
Next, the software metric acquisition logic 109 is read (S2402).
Next, the following processing is performed for all the program elements E (S2403 to S2408).
Next, the following processing is performed for all software metrics acquisition logic L (S2406 to S2404).

図21のソフトウェアメトリクス取得ロジック109で示されるソフトウェアメトリクス取得ロジックLのソフトウェアメトリクス取得ロジック本体1802を用いて、プログラム要素Eのソフトウェアメトリクス取得ロジックLに対応するソフトウェアメトリクスを取得する(S2405)。
以上を、全てのソフトウェアメトリクス取得ロジックLに対して実施する(S2404~S2406)。
Using the software metric acquisition logic main body 1802 of the software metric acquisition logic L shown by the software metric acquisition logic 109 of FIG. 21, software metrics corresponding to the software metric acquisition logic L of the program element E are acquired (S2405).
The above is carried out for all software metrics acquisition logic L (S2404 to S2406).

プログラム要素Eのメトリクス値を図22のソフトウェアメトリクス情報115に追加する(S2407)。
以上を、全てのプログラム要素Eに対して実施する(S2408)。
The metric value of the program element E is added to the software metric information 115 of FIG. 22 (S2407).
The above is carried out for all program elements E (S2408).

なお、プログラム解析部102の動作は、商用ツールとして販売されているプログラム解析ツールや、オープンソースで公開されているプログラム解析ツールで実施してもよい。 The operation of the program analysis unit 102 may be performed by a program analysis tool sold as a commercial tool or a program analysis tool published as open source.

次に、図28を用いてロジカルカップリンググラフ生成部103の処理について説明する。
本実施形態では、実施形態1の図15に示したロジカルカップリンググラフ生成部103の処理に対して、最初にソフトウェアメトリクスを読み込む(S1305)処理が追加されている。また、プログラム要素情報の生成(S1304)において、図29のフローチャートに示したソフトウェアメトリクスに関する処理が追加されている。
Next, the processing of the logical coupling graph generation unit 103 will be described with reference to FIG. 28.
In the present embodiment, a process of first reading software metrics (S1305) is added to the process of the logical coupling graph generation unit 103 shown in FIG. 15 of the first embodiment. Further, in the generation of program element information (S1304), the processing related to the software metrics shown in the flowchart of FIG. 29 is added.

なお、上記以外の処理は、実施形態1の図15に示したロジカルカップリンググラフ生成部103の処理と同じである。 The processing other than the above is the same as the processing of the logical coupling graph generation unit 103 shown in FIG. 15 of the first embodiment.

次に、図29を用いてプログラム要素情報生成処理(図28のS1304)について説明する。 Next, the program element information generation process (S1304 in FIG. 28) will be described with reference to FIG. 29.

本実施形態では、実施形態1の図17に示したプログラム要素情報生成処理の場合に比べて、ロジカルカップリンググラフの全ての頂点Nに対して実施する処理(S1501)の最初に、以下の処理が追加されている。 In the present embodiment, as compared with the case of the program element information generation processing shown in FIG. 17 of the first embodiment, the following processing is performed at the beginning of the processing (S1501) performed for all the vertices N of the logical coupling graph. Has been added.

全てのプログラム要素Eに対して以下の処理を実施する(S1507~S1509)。
頂点Nに対応するプログラム要素Eのソフトウェアメトリクス値を、頂点Nのプログラム要素情報に追加する(S1508)。
以上を、全てのプログラム要素Eに対して実施する(S1507~S1509)。
The following processing is performed for all program elements E (S1507 to S1509).
The software metric value of the program element E corresponding to the vertex N is added to the program element information of the vertex N (S1508).
The above is carried out for all program elements E (S1507 to S1509).

なお、上記以外の処理は、実施形態1の図17に示したプログラム要素情報生成処理と同じである。 The processing other than the above is the same as the program element information generation processing shown in FIG. 17 of the first embodiment.

このように、本実施形態によれば、プログラム要素の変更履歴だけでなく、ソフトウェアメトリクスを考慮することによって、アンチパターンが示す問題特徴をプログラム要素が備えているか否かをより高い精度で判定できるようになる。 As described above, according to the present embodiment, it is possible to determine with higher accuracy whether or not the program element has the problematic feature indicated by the anti-pattern by considering not only the change history of the program element but also the software metric. It will be like.

〔実施形態3〕
以下、本発明に係る実施形態3を、図30ないし図32を用いて説明する。
[Embodiment 3]
Hereinafter, the third embodiment according to the present invention will be described with reference to FIGS. 30 to 32.

実施形態1では、過去のプログラム要素の変更履歴に基づいてアンチパターングラフを生成するソースコード解析装置、実施形態2では、実施形態1の機能に加えて、ソースコードやソフトウェアメトリクス情報を加味して、アンチパターングラフを生成するソースコード解析装置について説明した。 In the first embodiment, a source code analysis device that generates an anti-pattern graph based on the change history of past program elements, and in the second embodiment, in addition to the functions of the first embodiment, source code and software metrics information are added. , A source code analyzer that generates anti-pattern graphs has been described.

本実施形態は、実施形態1または実施形態2におけるソフトウェアメトリクス閾値テーブル111、グラフパラメータ閾値テーブル112、パラメータ論理式113の情報を表示して、それらのソフトウェアメトリクス閾値テーブル111、グラフパラメータ閾値テーブル112、パラメータ論理式113のデータをユーザから入力させて、その値の変化に伴うアンチパターングラフ118の出力を、ユーザインターフェース上でインタラクティブに行うものである。 The present embodiment displays the information of the software metric threshold table 111, the graph parameter threshold table 112, and the parameter logic expression 113 in the first embodiment or the second embodiment, and displays the information of the software metric threshold table 111, the graph parameter threshold table 112, and the graph parameter threshold table 112. The data of the parameter logical expression 113 is input from the user, and the output of the anti-pattern graph 118 accompanying the change in the value is interactively performed on the user interface.

本実施形態では、実施形態1、実施形態2と異なる所を中心に説明する。
先ず、図30および図31を用いて実施形態2のソースコード解析装置の構成について説明する。
In this embodiment, the points different from those of the first and second embodiments will be mainly described.
First, the configuration of the source code analysis apparatus of the second embodiment will be described with reference to FIGS. 30 and 31.

本実施形態のソースコード解析装置10は、図30に示すように、図Tに示した実施形態2の場合に加えて、システムパラメータ入出力部120を備える。 As shown in FIG. 30, the source code analysis device 10 of the present embodiment includes a system parameter input / output unit 120 in addition to the case of the second embodiment shown in FIG. T.

システムパラメータ入出力部120は、ソフトウェアメトリクス閾値テーブル111、グラフパラメータ閾値テーブル112、パラメータ論理式113に対し入出力を行う機能部である。これらの入出力は、後に説明するシステムパラメータ更新画面2700によって行われる。 The system parameter input / output unit 120 is a functional unit that inputs / outputs to the software metric threshold table 111, the graph parameter threshold table 112, and the parameter logical formula 113. These inputs and outputs are performed by the system parameter update screen 2700 described later.

本実施形態のソースコード解析装置10は、実施形態1、実施形態2のソースコード解析装置10とハードウェア構成は同一である。 The source code analysis device 10 of the present embodiment has the same hardware configuration as the source code analysis device 10 of the first and second embodiments.

補助記憶装置13には、実施形態2のプログラムに加えて、システムパラメータ入出力プログラム1306がインストールされている。システムパラメータ入出力プログラム1306は、システムパラメータ入出力部120の機能を実行するプログラムである。 In addition to the program of the second embodiment, the system parameter input / output program 1306 is installed in the auxiliary storage device 13. The system parameter input / output program 1306 is a program that executes the function of the system parameter input / output unit 120.

次に、図32を用いてソースコード解析装置のユーザインターフェースについて説明する。
ユーザは、システムパラメータ更新画面2700を表示して、ディスプレイなどの出力装置15に、ソフトウェアメトリクス閾値テーブル111およびグラフパラメータ閾値テーブル112およびパラメータ論理式113の情報を表示し、データを入力して更新することができる。
Next, the user interface of the source code analyzer will be described with reference to FIG. 32.
The user displays the system parameter update screen 2700, displays the information of the software metric threshold table 111, the graph parameter threshold table 112, and the parameter logical formula 113 on the output device 15 such as a display, and inputs and updates the data. be able to.

システムパラメータ更新画面2700は、ソフトウェアメトリクス閾値入力欄2701、グラフパラメータ閾値入力欄2702、パラメータ論理式入力欄2703で構成される。 The system parameter update screen 2700 is composed of a software metric threshold input field 2701, a graph parameter threshold input field 2702, and a parameter logical formula input field 2703.

ソフトウェアメトリクス閾値入力欄2701は、1個以上のソフトウェアメトリクス閾値要素入力欄2704からなる。ソフトウェアメトリクス閾値要素入力欄2704は、ソフトウェアメトリクス識別子表示欄2705、ソフトウェアメトリクス名表示欄2706、ソフトウェアメトリクス閾値入力欄2707、ソフトウェアメトリクス判定条件入力欄2708、ソフトウェアメトリクス閾値入力スライダー2709からなる。 The software metric threshold input field 2701 includes one or more software metric threshold element input fields 2704. The software metric threshold element input field 2704 includes a software metric identifier display field 2705, a software metric name display field 2706, a software metric threshold input field 2707, a software metric determination condition input field 2708, and a software metric threshold input slider 2709.

ソフトウェアメトリクス識別子表示欄2705は、ソフトウェアメトリクス識別子2101が表示される欄である。ソフトウェアメトリクス名表示欄2706は、ソフトウェアメトリクス名2102が表示される欄である。ソフトウェアメトリクス閾値入力欄2707は、図24に示したソフトウェア閾値テーブル111におけるソフトウェアメトリクス閾値2103を入力するための欄である。ソフトウェアメトリクス判定条件入力欄2708は、ソフトウェアメトリクス判定条件2104を入力するための欄である。ソフトウェアメトリクス閾値入力スライダー2709は、ソフトウェアメトリクス閾値2103を視覚的に入力する欄である。 The software metric identifier display column 2705 is a column in which the software metric identifier 2101 is displayed. The software metric name display column 2706 is a column in which the software metric name 2102 is displayed. The software metric threshold input field 2707 is a field for inputting the software metric threshold 2103 in the software threshold table 111 shown in FIG. 24. The software metric determination condition input field 2708 is a field for inputting the software metric determination condition 2104. The software metric threshold input slider 2709 is a field for visually inputting the software metric threshold 2103.

グラフパラメータ閾値入力欄2702は、1個以上のグラフパラメータ閾値要素入力欄2710からなる。グラフパラメータ閾値要素入力欄2710は、グラフパラメータ識別子表示欄2711、グラフパラメータ名表示欄2712、グラフパラメータ閾値入力欄2713、グラフパラメータ判定条件入力欄2714、グラフパラメータ閾値入力スライダー2715からなる。 The graph parameter threshold input field 2702 includes one or more graph parameter threshold element input fields 2710. The graph parameter threshold element input field 2710 includes a graph parameter identifier display field 2711, a graph parameter name display field 2712, a graph parameter threshold input field 2713, a graph parameter determination condition input field 2714, and a graph parameter threshold input slider 2715.

グラフパラメータ識別子表示欄2711は、グラフパラメータ識別子901が表示される欄である。グラフパラメータ名表示欄2712は、グラフパラメータ名902が表示される欄である。グラフパラメータ閾値入力欄2713は、グラフパラメータ閾値903を入力するための欄である。グラフパラメータ判定条件入力欄2714は、グラフパラメータ判定条件904を入力するための欄である。グラフパラメータ閾値入力スライダー2715は、グラフパラメータ閾値903を視覚的に入力する欄である。 The graph parameter identifier display column 2711 is a column in which the graph parameter identifier 901 is displayed. The graph parameter name display column 2712 is a column in which the graph parameter name 902 is displayed. The graph parameter threshold value input field 2713 is a field for inputting the graph parameter threshold value 903. The graph parameter determination condition input field 2714 is a field for inputting the graph parameter determination condition 904. The graph parameter threshold value input slider 2715 is a field for visually inputting the graph parameter threshold value 903.

パラメータ論理式入力欄2703は、図10および図25に示したパラメータ論理式113を入力する欄である。 The parameter logical formula input field 2703 is a field for inputting the parameter logical formula 113 shown in FIGS. 10 and 25.

ユーザは、このようなソフトウェアメトリクス閾値入力欄2707、ソフトウェアメトリクス判定条件入力欄2708、ソフトウェアメトリクス閾値入力スライダー2709、グラフパラメータ閾値入力欄2707、グラフパラメータ判定条件入力欄2708、グラフパラメータ閾値入力スライダー2709、パラメータ論理式入力欄2703を用いて、ソフトウェアメトリクス閾値、グラフパラメータ閾値、パラメータ論理式を入力し、出力されるアンチパターングラフ118を確認することにより、ソフトウェアメトリクス値のインタラクティブな入力が可能になる。 The user can use such a software metric threshold input field 2707, a software metric judgment condition input field 2708, a software metric threshold input slider 2709, a graph parameter threshold input field 2707, a graph parameter judgment condition input field 2708, and a graph parameter threshold input slider 2709. By inputting the software metric threshold, the graph parameter threshold, and the parameter logical expression using the parameter logical expression input field 2703 and confirming the output anti-pattern graph 118, the interactive input of the software metric value becomes possible.

5…バス、10…ソースコード解析装置、11…プロセッサ、12…主記憶装置、13…補助記憶装置、14…入力装置、15…出力装置、16…通信装置、
101…ロジカルカップリング分析部、102…プログラム解析部、103…ロジカルカップリンググラフ生成部、104…アンチパターン検出部、105…情報記憶部、119…アンチパターン表示部、120…システムパラメータ入出力部、
108…ソースコード、109…ソフトウェアメトリクス取得ロジック、114…変更依存関係ルールテーブル、115…ソフトウェアメトリクス情報、116…ロジカルカップリンググラフ、117…プログラム要素情報
5 ... Bus, 10 ... Source code analyzer, 11 ... Processor, 12 ... Main storage device, 13 ... Auxiliary storage device, 14 ... Input device, 15 ... Output device, 16 ... Communication device,
101 ... Logical coupling analysis unit, 102 ... Program analysis unit, 103 ... Logical coupling graph generation unit, 104 ... Anti-pattern detection unit, 105 ... Information storage unit, 119 ... Anti-pattern display unit, 120 ... System parameter input / output unit ,
108 ... Source code, 109 ... Software metric acquisition logic, 114 ... Change dependency rule table, 115 ... Software metric information, 116 ... Logical coupling graph, 117 ... Program element information

Claims (8)

解析対象のプログラムのソースコードの保守性に関する問題を指摘するソースコード解析装置であって、
解析対象のプログラムの変更履歴と、プログラムの変更に関する指標の閾値を入力して、プログラム要素の変更依存関係ルールを出力するロジカルカップリング分析部と、
前記変更依存関係ルールに基づいて、プログラム要素をノード、同時変更されやすいプログラム要素の順序対を有向辺として、プログラム要素の変更依存関係を表現したロジカルカップリンググラフを生成するロジカルカップリング生成部と、
生成された前記ロジカルカップリンググラフと、プログラム要素毎に定められたグラフパラメータに関する情報に基づいて、ロジカルカップリンググラフにおいて保守性の低いプログラム要素を検出して、保守性の低いプログラム要素のノードを強調したアンチパターングラフとするアンチパターン検出部と、
前記アンチパターングラフを表示するアンチパターン表示部とからなることを特徴とするソースコード解析装置。
A source code analysis device that points out problems related to the maintainability of the source code of the program to be analyzed.
A logical coupling analysis unit that inputs the change history of the program to be analyzed and the threshold value of the index related to the program change and outputs the change dependency rule of the program element.
Based on the change dependency rule, a logical coupling generator that generates a logical coupling graph that expresses the change dependency of a program element, with the program element as a node and the ordered pair of program elements that are easily changed at the same time as directed edges. When,
Based on the generated logical coupling graph and the information about the graph parameters defined for each program element, the program element with low maintainability is detected in the logical coupling graph, and the node of the program element with low maintainability is detected. An anti-pattern detector that makes an emphasized anti-pattern graph,
A source code analysis device including an anti-pattern display unit that displays the anti-pattern graph.
さらに、前記解析対象のプログラムのソースコードと、ソフトウェアメトリクス毎にソフトウェアメトリクスロジックを定めるソフトウェアメトリクス取得ロジックを入力して、プログラム要素毎にソフトウェアメトリクスの値を定めたソフトウェアメトリクス情報を出力するプログラム解析部を有し、
前記アンチパターン検出部は、生成された前記ロジカルカップリンググラフと、プログラム要素毎に定められたグラフパラメータに関する情報と、さらに、ソフトウェアメトリクスに関する情報に基づいて、前記ロジカルカップリンググラフを保守性の低いプログラム要素のノードを強調したアンチパターングラフとすることを特徴とする請求項1記載のソースコード解析装置。
Further, a program analysis unit that inputs the source code of the program to be analyzed and the software metric acquisition logic that defines the software metric logic for each software metric, and outputs the software metric information that defines the software metric value for each program element. Have,
The anti-pattern detection unit has low maintainability of the logical coupling graph based on the generated logical coupling graph, information on graph parameters defined for each program element, and information on software metrics. The source code analysis device according to claim 1, wherein the anti-pattern graph emphasizes the nodes of the program element.
前記グラフパラメータに関する値、前記グラフパラメータに関する判定条件、前記グラフパラメータの判定のための論理式を入力する手段を備えることを特徴とする請求項1記載のソースコード解析装置。 The source code analysis apparatus according to claim 1, further comprising means for inputting a value relating to the graph parameter, a determination condition relating to the graph parameter, and a logical expression for determining the graph parameter. 前記ソフトウェアメトリクスに関する値、前記ソフトウェアメトリクスに関する判定条件、前記ソフトウェアメトリクスの判定のための論理式を入力する手段を備えることを特徴とする請求項2記載のソースコード解析装置。 The source code analysis apparatus according to claim 2, further comprising means for inputting a value related to the software metric, a determination condition related to the software metric, and a logical expression for determining the software metric. 解析対象のプログラムのソースコードの保守性に関する問題を指摘するソースコード解析方法であって、
解析対象のプログラムの変更履歴と、プログラムの変更に関する指標の閾値を入力して、プログラム要素の変更依存関係ルールを出力するロジカルカップリング分析ステップと、
前記変更依存関係ルールに基づいて、プログラム要素をノード、同時変更されやすいプログラム要素の順序対を有向辺として、プログラム要素の変更依存関係を表現したロジカルカップリンググラフを生成するロジカルカップリング生成ステップと、
生成された前記ロジカルカップリンググラフと、プログラム要素毎に定められたグラフパラメータに関する情報に基づいて、ロジカルカップリンググラフにおいて保守性の低いプログラム要素を検出して、保守性の低いプログラム要素のノードを強調したアンチパターングラフとするアンチパターン検出ステップと、
前記アンチパターングラフを表示するアンチパターン表示ステップとからなることを特徴とするソースコード解析方法。
It is a source code analysis method that points out problems related to the maintainability of the source code of the program to be analyzed.
A logical coupling analysis step that outputs the change dependency rule of the program element by inputting the change history of the program to be analyzed and the threshold value of the index related to the change of the program.
Based on the change dependency rule, the logical coupling generation step to generate a logical coupling graph expressing the change dependency of the program element by using the program element as a node and the ordered pair of the program elements that are easily changed at the same time as the directed edge. When,
Based on the generated logical coupling graph and the information about the graph parameters defined for each program element, the program element with low maintainability is detected in the logical coupling graph, and the node of the program element with low maintainability is detected. An anti-pattern detection step with an emphasized anti-pattern graph,
A source code analysis method comprising an anti-pattern display step for displaying the anti-pattern graph.
さらに、前記解析対象のプログラムのソースコードと、ソフトウェアメトリクス毎にソフトウェアメトリクスロジックを定めるソフトウェアメトリクス取得ロジックを入力して、プログラム要素毎にソフトウェアメトリクスの値を定めたソフトウェアメトリクス情報を出力するプログラム解析ステップを有し、
前記アンチパターン検出ステップは、生成された前記ロジカルカップリンググラフと、プログラム要素毎に定められたグラフパラメータに関する情報と、さらに、ソフトウェアメトリクスに関する情報に基づいて、前記ロジカルカップリンググラフを保守性の低いプログラム要素のノードを強調したアンチパターングラフとすることを特徴とする請求項5記載のソースコード解析方法。
Further, a program analysis step in which the source code of the program to be analyzed and the software metric acquisition logic that defines the software metric logic for each software metric are input, and the software metric information that defines the software metric value for each program element is output. Have,
The anti-pattern detection step makes the logical coupling graph less maintainable based on the generated logical coupling graph, information about graph parameters defined for each program element, and information about software metrics. The source code analysis method according to claim 5, wherein the anti-pattern graph emphasizes the nodes of the program element.
前記グラフパラメータに関する値、前記グラフパラメータに関する判定条件、前記グラフパラメータの判定のための論理式を入力するステップを有することを特徴とする請求項5記載のソースコード解析方法。 The source code analysis method according to claim 5, further comprising a step of inputting a value relating to the graph parameter, a determination condition relating to the graph parameter, and a logical expression for determining the graph parameter. 前記ソフトウェアメトリクスに関する値、前記ソフトウェアメトリクスに関する判定条件、前記ソフトウェアメトリクスの判定のための論理式を入力するステップを有することを特徴とする請求項6記載のソースコード解析方法。 The source code analysis method according to claim 6, further comprising a step of inputting a value relating to the software metric, a determination condition relating to the software metric, and a logical expression for determining the software metric.
JP2017184915A 2017-09-26 2017-09-26 Source code analyzer and source code analysis method Active JP7029915B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2017184915A JP7029915B2 (en) 2017-09-26 2017-09-26 Source code analyzer and source code analysis method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2017184915A JP7029915B2 (en) 2017-09-26 2017-09-26 Source code analyzer and source code analysis method

Publications (2)

Publication Number Publication Date
JP2019061438A JP2019061438A (en) 2019-04-18
JP7029915B2 true JP7029915B2 (en) 2022-03-04

Family

ID=66176643

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2017184915A Active JP7029915B2 (en) 2017-09-26 2017-09-26 Source code analyzer and source code analysis method

Country Status (1)

Country Link
JP (1) JP7029915B2 (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170091073A1 (en) 2015-09-30 2017-03-30 International Business Machines Corporation Detection of antipatterns through statistical analysis

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9690553B1 (en) * 2016-09-26 2017-06-27 International Business Machines Corporation Identifying software dependency relationships

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170091073A1 (en) 2015-09-30 2017-03-30 International Business Machines Corporation Detection of antipatterns through statistical analysis

Also Published As

Publication number Publication date
JP2019061438A (en) 2019-04-18

Similar Documents

Publication Publication Date Title
JP6985350B2 (en) Data system summary
CN109710306B (en) Source code analysis device, source code analysis method, and computer-readable recording medium
KR101631978B1 (en) Mapping dataset elements
US8726236B2 (en) Determining context specific content
JP6158623B2 (en) Database analysis apparatus and method
US8086997B2 (en) Detecting aspectual behavior in unified modeling language artifacts
JP6256115B2 (en) Operation search program, operation search method, and operation search device
US11922230B2 (en) Natural language processing of API specifications for automatic artifact generation
JP2016157290A (en) Document search apparatus, document search method, and document search program
CN106484389B (en) Action stream segment management
CN110618926A (en) Source code analysis method and source code analysis device
JP6800716B2 (en) Data analyzers, data analysis methods, and data analysis programs
Ackermann et al. Black-box learning of parametric dependencies for performance models
JP7029915B2 (en) Source code analyzer and source code analysis method
US11971813B2 (en) Data driven testing automation using machine learning
JP7275591B2 (en) Evaluation support program, evaluation support method, and information processing device
US20210182701A1 (en) Virtual data scientist with prescriptive analytics
Raamesh et al. Reliable mining of automatically generated test cases from software requirements specification (SRS)
JP7235269B2 (en) Data item name estimation device, data item name estimation program, and data item name estimation method
JP2018190219A (en) Software specification analyzer and software specification analytical method
EP3671467A1 (en) Gui application testing using bots
Dogan et al. Parallelism-based session creation to identify high-level activities in event log abstraction
JP7075011B2 (en) Information processing device, patch application confirmation system, patch application confirmation method, and patch application confirmation program
US20180227183A1 (en) Refining of Applicability Rules of Management Activities According to Missing Fulfilments Thereof
JP7239519B2 (en) Machine learning model operation management system and operation management method

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20200305

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20210113

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20210126

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20210311

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20210817

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20210907

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20220201

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20220221

R150 Certificate of patent or registration of utility model

Ref document number: 7029915

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150