JP2010282441A - Apparatus for calculating inter-module dependent strength, method and program for measuring inter-module dependent strength - Google Patents

Apparatus for calculating inter-module dependent strength, method and program for measuring inter-module dependent strength Download PDF

Info

Publication number
JP2010282441A
JP2010282441A JP2009135526A JP2009135526A JP2010282441A JP 2010282441 A JP2010282441 A JP 2010282441A JP 2009135526 A JP2009135526 A JP 2009135526A JP 2009135526 A JP2009135526 A JP 2009135526A JP 2010282441 A JP2010282441 A JP 2010282441A
Authority
JP
Japan
Prior art keywords
module
modules
global variable
source code
global
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.)
Pending
Application number
JP2009135526A
Other languages
Japanese (ja)
Inventor
Toshikazu Hashimoto
俊和 橋本
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.)
Sharp Corp
Original Assignee
Sharp Corp
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 Sharp Corp filed Critical Sharp Corp
Priority to JP2009135526A priority Critical patent/JP2010282441A/en
Publication of JP2010282441A publication Critical patent/JP2010282441A/en
Pending legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To provide an apparatus for calculating inter-module dependent strength and a method and a program for measuring inter-module dependent strength which quantitatively evaluate dependent strength between modules even in software prepared by a language whose class is not supported and which have high versatility. <P>SOLUTION: In the apparatus 10 for calculating inter-module dependent strength, a source code acquisition part 11 obtains source codes by a module unit. A global variable extraction part 12 extracts global variables included in source codes of at least a part of modules. An access frequency counting part 13 finds out access frequencies for at least a part of global variables for each global variable. A dependent strength calculation part calculates dependent strength between a plurality of modules for each global variable based on the access frequency. <P>COPYRIGHT: (C)2011,JPO&INPIT

Description

本発明は、ソフトウェアに含まれる複数のモジュールが互いに及ぼし合う影響の度合を定量的に評価するモジュール間依存強度算出装置、モジュール間依存強度測定方法およびモジュール間依存強度測定プログラムに関する。   The present invention relates to an inter-module dependency strength calculation apparatus, an inter-module dependency strength measurement method, and an inter-module dependency strength measurement program that quantitatively evaluate the degree of influence of a plurality of modules included in software.

ソフトウェア開発において、機能毎にまとまりを持ったソフトウェアの構成単位は、一般的にモジュールと呼ばれる。モジュール毎にソフトウェアを開発することにによって、モジュール毎に並行して開発・テストが行うことができ、効率的なソフトウェア開発を行うことができる。またモジュールにソフトウェアの一構成部品として所定の機能を持たせ、汎用性を有するモジュールを開発することによって、同一のモジュールを互いに異なる複数のソフトウェアにおいて広く利用することができる。   In software development, a software unit having a group for each function is generally called a module. By developing software for each module, development and testing can be performed in parallel for each module, and efficient software development can be performed. Further, by providing a module with a predetermined function as one component of software and developing a module having versatility, the same module can be widely used in a plurality of different software.

しかし、ソフトウェアをモジュールに細かく分割すれば分割するほど、複数のモジュール間の依存関係が複雑になり、ソフトウェアの保守性の低下を招いてしまうという問題点がある。したがって、過度にモジュール間の依存関係が複雑化することによるソフトウェアの保守性低下の可能性の増大を抑制するために、モジュール間の依存関係を定量的に評価し把握することが望まれる。   However, there is a problem in that the more software is divided into modules, the more complicated the dependency relationship between the modules and the lowering of software maintainability. Therefore, it is desirable to quantitatively evaluate and grasp the dependency relationship between modules in order to suppress an increase in the possibility of a decrease in software maintainability due to excessively complicated dependency relationship between modules.

従来技術に係るモジュール間依存強度算出装置として、ソフトウェアのクラスを抽出し、その組合せを導出する全クラス総組合せ導出部と、分析部および分析値格納部を有するソフトウェア・モジュール間の依存度計測装置が知られる。このソフトウェア・モジュール間の依存度計測装置では、あるクラスに属するオブジェクトのデータについての依存度とオブジェクトへの入出力、およびオブジェクト内の操作についての依存度を計測する(たとえば特許文献1参照)。   As an inter-module dependency strength calculation device according to the prior art, a dependency measurement device between software modules having an all-class total combination deriving unit for extracting a class of software and deriving the combination, and an analysis unit and an analysis value storage unit Is known. This dependency measurement device between software modules measures the dependency on the data of an object belonging to a certain class, the input / output to / from the object, and the dependency on the operation in the object (see, for example, Patent Document 1).

特開2000−215045号公報Japanese Patent Laid-Open No. 2000-215045

従来技術に係るモジュール間依存強度算出装置では、クラスと呼ばれるオブジェクト指向の概念を利用しているので、C++およびJava(登録商標)などのオブジェクト指向のプログラミング言語、すなわちクラスをサポートするプログラミング言語しか適用できないという問題点がある。   Since the inter-module dependency strength calculation apparatus according to the prior art uses an object-oriented concept called class, only object-oriented programming languages such as C ++ and Java (registered trademark), that is, programming languages that support classes are applied. There is a problem that it is not possible.

本発明の目的は、クラスをサポートしていないプログラミング言語で作成されたソフトウェアについてもモジュール間の依存強度を定量的に評価することのできる、汎用性の高いモジュール間依存強度算出装置、モジュール間依存強度測定方法およびモジュール間依存強度測定プログラムを提供することである。   An object of the present invention is to provide a highly versatile inter-module dependency strength calculation apparatus and inter-module dependency that can quantitatively evaluate the dependency strength between modules even for software created in a programming language that does not support classes. An intensity measurement method and an inter-module dependent intensity measurement program are provided.

本発明は、ソースコードをモジュール単位で取得するソースコード取得部と、
前記ソースコード取得部によって取得されたモジュールのうち、少なくとも一部のモジュールのソースコードに含まれるグローバル変数を抽出するグローバル変数抽出部と、
前記グローバル変数抽出部によって抽出されたグローバル変数のうち、少なくとも一部のグローバル変数について、前記少なくとも一部のモジュールのうち複数のモジュールにおける前記グローバル変数に対するアクセス回数を、前記グローバル変数毎に計測するアクセス回数計測部と、
前記アクセス回数計測部によってアクセス回数が計測された前記複数のモジュール間の依存強度を、前記アクセス回数に基づいてグローバル変数毎に算出する依存強度算出部とを含むことを特徴とするモジュール間依存強度算出装置である。
The present invention includes a source code acquisition unit that acquires source code in module units,
A global variable extraction unit that extracts global variables included in the source code of at least some of the modules acquired by the source code acquisition unit;
Access for measuring, for each global variable, the number of accesses to the global variable in a plurality of modules among the at least some of the global variables extracted by the global variable extraction unit. Counting unit,
A dependency strength calculating unit that calculates a dependency strength between the plurality of modules whose access count is measured by the access count measuring unit for each global variable based on the access count. It is a calculation device.

また本発明は、前記アクセス回数計測部は、アクセス回数の計測の対象となる前記複数のモジュールのうち、1つのモジュールにおける前記グローバル変数に対する書き込み回数と、残余のモジュールにおける前記グローバル変数に対する読み込み回数とを、アクセス回数として計測し、
前記依存強度算出部は、前記1つのモジュールに対する残余のモジュールの、グローバル変数を介する依存強度を、前記1つのモジュールにおける前記グローバル変数に対する書き込み回数と、残余のモジュールにおける前記グローバル変数に対する読み込み回数とに基づいて算出することを特徴とする。
Further, according to the present invention, the access count measuring unit includes the number of writes to the global variable in one module, the number of reads to the global variable in the remaining modules, among the plurality of modules to be measured for the number of accesses. As the number of accesses,
The dependency strength calculation unit sets the dependency strength of the remaining modules for the one module via the global variable to the number of writes to the global variable in the one module and the number of reads to the global variable in the remaining module. It is calculated based on.

また本発明は、前記依存強度算出部は、前記複数のモジュールのうち1つのモジュールに対する残余のモジュールの、グローバル変数に関する依存強度を、前記1つのモジュールにおける前記グローバル変数に対する書き込み回数と、残余のモジュールにおける前記グローバル変数に対する読み込み回数との積として算出することを特徴とする。   Further, according to the present invention, the dependency strength calculation unit is configured to determine the dependency strength of a remaining module for one module among the plurality of modules, the number of times of writing to the global variable in the one module, and the remaining module. It is calculated as the product of the number of reads for the global variable in

また本発明は、前記アクセス回数計測部は、前記グローバル変数抽出部によってグローバル変数が抽出された前記少なくとも一部のモジュールのうち、2つのモジュールのソースコードに含まれる全てのグローバル変数について、前記2つのモジュールにおける前記グローバル変数に対するアクセス回数を、前記グローバル変数毎に計測し、
前記依存強度算出部は、前記2つのモジュールのうち一方のモジュールに対する他方のモジュールの総合依存強度であって、
一方のモジュールに対する他方のモジュールの依存強度が、これら2つのモジュールのソースコードに含まれる全てのグローバル変数に関して合計されることによって求まる総合依存強度を算出することを特徴とする。
According to the present invention, the access count measuring unit is configured to perform the above-described processing on all the global variables included in the source code of two modules among the at least some modules from which the global variables are extracted by the global variable extracting unit. The number of accesses to the global variable in one module is measured for each global variable,
The dependence strength calculating unit is a total dependence strength of the other module with respect to one of the two modules,
It is characterized in that a total dependency strength obtained by summing the dependency strength of the other module with respect to one module with respect to all global variables included in the source code of these two modules is calculated.

また本発明は、前記モジュール間依存強度算出装置を用い、
ソースコードを前記ソースコード取得部によってモジュール単位で取得するソースコード取得工程と、
前記ソースコード取得工程において取得されたモジュールのうち、少なくとも一部のモジュールのソースコードに含まれるグローバル変数を前記グローバル変数抽出部によって抽出するグローバル変数抽出工程と、
前記グローバル変数抽出工程において抽出されたグローバル変数のうち、少なくとも一部のグローバル変数について、前記少なくとも一部のモジュールのうち複数のモジュールにおける前記グローバル変数に対するアクセス回数を、前記アクセス回数計測部によって前記グローバル変数毎に計測するアクセス回数計測工程と、
前記アクセス回数計測工程においてアクセス回数が計測された前記複数のモジュール間の依存強度を、前記依存強度算出部によって前記アクセス回数に基づいてグローバル変数毎に算出する依存強度算出工程とを含むことを特徴とするモジュール間依存強度算出方法である。
Further, the present invention uses the inter-module dependence strength calculation device,
A source code obtaining step of obtaining source code in module units by the source code obtaining unit;
Of the modules acquired in the source code acquisition step, a global variable extraction step of extracting global variables included in the source code of at least some modules by the global variable extraction unit;
Of the global variables extracted in the global variable extraction step, for at least some of the global variables, the number of accesses to the global variables in a plurality of modules of the at least some of the modules is determined by the access count measurement unit. Access count measurement process to measure for each variable,
A dependency strength calculation step of calculating, for each global variable, the dependency strength between the plurality of modules whose access count has been measured in the access count measurement step based on the access count by the dependency strength calculation unit. The inter-module dependence strength calculation method.

また本発明は、コンピュータを、
ソースコードをモジュール単位で取得するソースコード取得部、
前記ソースコード取得部によって取得されたモジュールのうち、少なくとも一部のモジュールのソースコードに含まれるグローバル変数を抽出するグローバル変数抽出部、
前記グローバル変数抽出部によって抽出されたグローバル変数のうち、少なくとも一部のグローバル変数について、前記少なくとも一部のモジュールのうち複数のモジュールにおける前記グローバル変数に対するアクセス回数を、前記グローバル変数毎に計測するアクセス回数計測部、および
前記アクセス回数計測部によってアクセス回数が計測された前記複数のモジュール間の依存強度を、前記アクセス回数に基づいてグローバル変数毎に算出する依存強度算出部として機能させることを特徴とするモジュール間依存強度算出プログラムである。
The present invention also provides a computer,
Source code acquisition unit that acquires source code in module units,
A global variable extraction unit that extracts global variables included in the source code of at least some of the modules acquired by the source code acquisition unit;
Access for measuring, for each global variable, the number of accesses to the global variable in a plurality of modules among the at least some of the global variables extracted by the global variable extraction unit. A frequency measurement unit, and a dependency strength calculation unit that calculates the dependence strength between the plurality of modules whose access count is measured by the access count measurement unit for each global variable based on the access count. This is an inter-module dependence strength calculation program.

本発明によれば、アクセス回数計測部は、グローバル変数抽出部によって抽出されたグローバル変数のうち、少なくとも一部のグローバル変数について、アクセス回数をグローバル変数毎に求める。アクセス回数は、複数のモジュールにおけるグローバル変数に対するアクセス回数である。依存強度算出部は、この複数のモジュール間の依存強度を、アクセス回数に基づいてグローバル変数毎に算出する。これによって、モジュールのソースコードに複数種類のグローバル変数が用いられ、複数のモジュールが、複数のグローバル変数を介して関係している場合にも、複数のモジュール間の依存強度を算出することができる。したがって、クラスをサポートしていない非オブジェクト指向のプログラミング言語で作成されたソフトウェアについても、モジュール間の依存強度を定量的に評価することができる。これによって、汎用性の高いモジュール間依存強度算出装置を実現することができる。またこれによって、ソースコードをモジュール単位で含むソフトウェアを開発するときに、モジュール間の依存関係が複雑化しているモジュールを見つけ出すことができる。したがって、モジュール間の依存関係の複雑化によるソフトウェア開発において、ソフトウェアの保守性低下の可能性を抑制することが可能となる。   According to the present invention, the access count measurement unit obtains the access count for each global variable for at least some of the global variables extracted by the global variable extraction unit. The number of accesses is the number of accesses to a global variable in a plurality of modules. The dependency strength calculation unit calculates the dependency strength between the plurality of modules for each global variable based on the number of accesses. As a result, even when a plurality of types of global variables are used in the module source code, and the plurality of modules are related via a plurality of global variables, the dependency strength between the plurality of modules can be calculated. . Therefore, the dependency strength between modules can be quantitatively evaluated even for software created in a non-object-oriented programming language that does not support classes. As a result, a highly versatile inter-module dependence strength calculating device can be realized. This also makes it possible to find a module in which the dependency relationship between modules is complicated when developing software including source code in module units. Therefore, it is possible to suppress the possibility of a decrease in software maintainability in software development due to the complicated dependency between modules.

また本発明によれば、依存強度算出部は、1つのモジュールに対する残余のモジュールの、グローバル変数を介する依存強度を算出する。この依存強度は、前記1つのモジュールにおけるグローバル変数に対する書き込み回数と、残余のモジュールにおけるグローバル変数に対する読み込み回数とに基づいて算出する。これによって、複数のモジュールのうち1つのモジュールに対する残余のモジュールの依存強度を、グローバル変数に関して算出することができる。したがって、複数のモジュール間における影響の大きさを、グローバル変数を介して影響する側のモジュールと影響される側のモジュールとを区別して、定量的に評価することができる。   According to the invention, the dependency strength calculation unit calculates the dependency strength of the remaining modules for one module via the global variable. This dependency strength is calculated based on the number of writes to the global variable in the one module and the number of reads to the global variable in the remaining modules. As a result, the dependency strength of the remaining modules with respect to one module among the plurality of modules can be calculated with respect to the global variable. Therefore, the magnitude of the influence between the plurality of modules can be quantitatively evaluated by distinguishing the module on the influence side from the module on the influence side via the global variable.

また本発明によれば、依存強度算出部は、アクセス回数の計測の対象となる前記複数のモジュールのうち1つのモジュールに対する残余のモジュールの、グローバル変数に関する依存強度を、前記1つのモジュールにおけるグローバル変数に対する書き込み回数と、残余のモジュールにおけるグローバル変数に対する読込み回数との積として算出する。これによって、モジュール間の影響を、書き込み回数と読込み回数とに応じて定量的に評価することができる。グローバル変数に対して書き込みを行うモジュールは、このグローバル変数を読込む他のモジュールに影響を与え、その影響の度合は、書き込み回数および読込み回数が多くなればなるほど大きくなる。したがって、1つのモジュールに対する残余のモジュールによる影響を、書き込み回数と読込み回数とに応じて定量的に評価することができる。   Further, according to the present invention, the dependency strength calculation unit calculates a dependency strength related to a global variable of a remaining module with respect to one module among the plurality of modules for which the number of accesses is measured, as a global variable in the one module. Is calculated as the product of the number of writes to and the number of reads for the global variables in the remaining modules. Thereby, the influence between modules can be evaluated quantitatively according to the number of times of writing and the number of times of reading. A module that writes to a global variable affects other modules that read the global variable, and the degree of influence increases as the number of writes and the number of reads increase. Therefore, the influence of the remaining modules on one module can be quantitatively evaluated according to the number of times of writing and the number of times of reading.

また本発明によれば、アクセス回数計測部は、2つのモジュールのソースコードに含まれる全てのグローバル変数について、この2つのモジュールにおけるグローバル変数に対するアクセス回数を、グローバル変数毎に計測する。依存強度算出部は、前記2つのモジュールのうち一方のモジュールに対する他方のモジュールの総合依存強度を算出する。総合依存強度は、一方のモジュールに対する他方のモジュールの依存強度が、これら2つのモジュールのソースコードに含まれる全てのグローバル変数に関して合計されることによって求まる。これによって、一方のモジュールと他方のモジュールとの影響を、これら2つのモジュールのソースコードに含まれる全てのグローバル変数に関して総合的に評価することができる。これによって、ソースコードをモジュール単位で含むソフトウェアを開発するときに、モジュール間の依存関係が複雑化しているモジュールを見つけ出すことができる。したがって、ソフトウェアの開発において、ソフトウェアの保守性低下の可能性を抑制することができる。   According to the present invention, the access count measuring unit measures the access count for the global variables in the two modules for each global variable for all global variables included in the source code of the two modules. The dependency strength calculation unit calculates the total dependency strength of the other module with respect to one of the two modules. The total dependency strength is obtained by summing the dependency strength of the other module with respect to one module with respect to all global variables included in the source code of these two modules. Thus, the influence of one module and the other module can be comprehensively evaluated with respect to all global variables included in the source code of these two modules. As a result, when developing software including source code in units of modules, it is possible to find a module having a complicated dependency relationship between modules. Therefore, in software development, the possibility of software maintainability degradation can be suppressed.

また本発明によれば、アクセス回数計測工程では、少なくとも一部のグローバル変数について、アクセス回数を、アクセス回数計測部によって、グローバル変数毎に計測する。依存強度算出工程では、複数のモジュール間の依存強度を、依存強度算出部によってアクセス回数に基づいてグローバル変数毎に算出する。これによって、モジュールのソースコードに複数種類のグローバル変数が用いられ、複数のモジュールが、複数のグローバル変数を介して関係している場合にも、複数のモジュール間の依存強度を算出することができる。したがって、クラスをサポートしていない非オブジェクト指向のプログラミング言語で作成されたソフトウェアについても、モジュール間の依存強度を定量的に評価することができる。これによって、汎用性の高いモジュール間依存強度算出装置を実現することができる。またこれによって、ソースコードをモジュール単位で含むソフトウェアを開発するときに、モジュール間の依存関係が複雑化しているモジュールを見つけ出すことができる。したがって、モジュール間の依存関係の複雑化によるソフトウェア開発において、ソフトウェアの保守性低下の可能性を抑制することが可能となる。   According to the present invention, in the access count measuring step, the access count is measured for each global variable by the access count measuring section for at least some of the global variables. In the dependency strength calculation step, the dependency strength between the plurality of modules is calculated for each global variable based on the number of accesses by the dependency strength calculation unit. As a result, even when a plurality of types of global variables are used in the module source code and the plurality of modules are related via the plurality of global variables, the dependency strength between the plurality of modules can be calculated. . Therefore, the dependency strength between modules can be quantitatively evaluated even for software created in a non-object-oriented programming language that does not support classes. As a result, a highly versatile inter-module dependence strength calculating device can be realized. This also makes it possible to find a module in which the dependency relationship between modules is complicated when developing software including source code in module units. Therefore, it is possible to suppress the possibility of a decrease in software maintainability in software development due to the complicated dependency between modules.

また本発明によれば、モジュール間依存強度算出プログラムは、コンピュータを、ソースコード取得部、グローバル変数抽出部、アクセス回数計測部、および依存強度算出部として機能させる。これによって、コンピュータをモジュール間依存強度算出装置として機能させることができる。   According to the present invention, the inter-module dependency strength calculation program causes a computer to function as a source code acquisition unit, a global variable extraction unit, an access count measurement unit, and a dependency strength calculation unit. As a result, the computer can function as an inter-module dependence strength calculation device.

本発明の第1実施形態に係るモジュール間依存強度算出装置10の構成を表すブロック図である。It is a block diagram showing the structure of the inter-module dependence intensity | strength calculation apparatus 10 which concerns on 1st Embodiment of this invention. 本発明の第1実施形態に係るモジュール間依存強度算出方法の各工程を表すフローチャートである。It is a flowchart showing each process of the inter-module dependence intensity | strength calculation method which concerns on 1st Embodiment of this invention. 本発明の第1実施形態においてソースコード取得部11によって取得されるソースコードの一例を表す図である。It is a figure showing an example of the source code acquired by the source code acquisition part 11 in 1st Embodiment of this invention. 本発明の第1実施形態におけるグローバル変数抽出工程の各段階を表すフローチャートである。It is a flowchart showing each stage of the global variable extraction process in 1st Embodiment of this invention. 本発明の第1実施形態におけるアクセス回数計測工程の各段階を表すフローチャートである。It is a flowchart showing each step | level of the access frequency measurement process in 1st Embodiment of this invention. 本発明の第1実施形態における各グローバル変数の、各モジュールにおけるアクセスの様子を表す図である。It is a figure showing the mode of access in each module of each global variable in 1st Embodiment of this invention. 本発明の第1実施形態における依存強度算出工程の各段階を表すフローチャートである。It is a flowchart showing each step of the dependence intensity | strength calculation process in 1st Embodiment of this invention.

以下、図面を参照しながら本発明を実施するための形態を、複数の形態について説明する。以下の説明においては、各形態に先行する形態ですでに説明している事項に対応している部分には同一の参照符を付し、重複する説明を略す場合がある。構成の一部のみを説明している場合、構成の他の部分は、先行して説明している形態と同様とする。実施の各形態で具体的に説明している部分の組合せばかりではなく、特に組合せに支障が生じなければ、実施の形態同士を部分的に組合せることも可能である。またそれぞれの実施形態は、本発明に係る技術を具体化するために例示するものであり、本発明の技術的範囲を限定するものではない。本発明に係る技術内容は、特許請求の範囲に記載された技術的範囲内において、種々の変更を加えることが可能である。以下の説明は、モジュール間依存強度算出装置10、モジュール間依存強度測定方法およびモジュール間依存強度測定プログラムについての説明をも含む。   Hereinafter, a plurality of embodiments for carrying out the present invention will be described with reference to the drawings. In the following description, parts corresponding to items already described in the forms preceding each form may be denoted by the same reference numerals, and overlapping descriptions may be omitted. When only a part of the configuration is described, the other parts of the configuration are the same as those described in the preceding section. Not only the combination of the parts specifically described in each embodiment, but also the embodiments can be partially combined as long as the combination does not hinder. Moreover, each embodiment is illustrated in order to embody the technique which concerns on this invention, and does not limit the technical scope of this invention. The technical contents according to the present invention can be variously modified within the technical scope described in the claims. The following description also includes descriptions of the inter-module dependence strength calculation device 10, the inter-module dependence strength measurement method, and the inter-module dependence strength measurement program.

(第1実施形態)
図1は、本発明の第1実施形態に係るモジュール間依存強度算出装置10の構成を表すブロック図である。モジュール間依存強度算出装置10は、ソフトウェアに含まれる複数のモジュールが互いに及ぼし合う影響の度合を定量的に評価する装置である。第1実施形態において、モジュール間依存強度算出装置10は、ソースコード取得部11と、グローバル変数抽出部12と、アクセス回数計測部13と、依存強度算出部14とを備える。ソースコード取得部11は、ソースコードをモジュール単位で取得する。
(First embodiment)
FIG. 1 is a block diagram showing a configuration of an inter-module dependence strength calculation apparatus 10 according to the first embodiment of the present invention. The inter-module dependence strength calculation device 10 is a device that quantitatively evaluates the degree of influence of a plurality of modules included in software on each other. In the first embodiment, the inter-module dependency strength calculation device 10 includes a source code acquisition unit 11, a global variable extraction unit 12, an access count measurement unit 13, and a dependency strength calculation unit 14. The source code acquisition unit 11 acquires source code in module units.

グローバル変数抽出部12は、ソースコード取得部11によって取得されたモジュールのうち、少なくとも一部のモジュールのソースコード15に含まれるグローバル変数を抽出する。グローバル変数は、互いに異なる複数のモジュールにおいてアクセスされる変数である。アクセスは、モジュールに含まれるソースコード15内での、グローバル変数に対する書き込みと、読み込みとを含み、アクセス回数は、書き込み回数と読み込み回数とを含む。   The global variable extraction unit 12 extracts global variables included in the source code 15 of at least some of the modules acquired by the source code acquisition unit 11. A global variable is a variable accessed in a plurality of different modules. Access includes writing to and reading from a global variable within the source code 15 included in the module, and the access count includes the write count and the read count.

アクセス回数計測部13は、グローバル変数抽出部12によって抽出されたグローバル変数のうち、少なくとも一部のグローバル変数について、アクセス回数をグローバル変数毎に求める。アクセス回数は、複数のモジュールにおけるグローバル変数に対するアクセス回数である。この複数のモジュールは、グローバル変数抽出部12によってグローバル変数の抽出の対象となったモジュールのうちの複数のモジュールである。依存強度算出部14は、この複数のモジュール間の依存強度19を、アクセス回数に基づいてグローバル変数毎に算出する。   The access count measurement unit 13 obtains the access count for each global variable for at least some of the global variables extracted by the global variable extraction unit 12. The number of accesses is the number of accesses to a global variable in a plurality of modules. The plurality of modules are a plurality of modules among the modules that are global variable extraction targets by the global variable extraction unit 12. The dependency strength calculation unit 14 calculates the dependency strength 19 between the plurality of modules for each global variable based on the number of accesses.

第1実施形態において、依存強度19は、グローバル変数を介して異なる複数のモジュールに含まれる1つのソースコード15と他のソースコード15とが互いに関係を有するときの、これらソースコード15とソースコード15との関係の深さを表す。ソースコード15は、モジュール単位で取扱われるので、モジュールとしてのまとまりを有するソースコード15を、単に「モジュール」と称することがある。   In the first embodiment, the dependency strength 19 is obtained when one source code 15 and another source code 15 included in a plurality of different modules via a global variable are related to each other. 15 represents the depth of the relationship. Since the source code 15 is handled in units of modules, the source code 15 having a unit as a module may be simply referred to as a “module”.

アクセス回数計測部13は、アクセス回数の計測の対象となる複数のモジュールのうち、1つのモジュールにおけるグローバル変数に対する書き込み回数と、残余のモジュールにおけるグローバル変数に対する読み込み回数とを、アクセス回数として計測する。依存強度算出部14は、前記1つのモジュールに対する残余のモジュールの、グローバル変数を介する依存強度19を算出する。この依存強度19は、前記1つのモジュールにおけるグローバル変数に対する書き込み回数と、残余のモジュールにおけるグローバル変数に対する読み込み回数とに基づいて算出する。   The access count measurement unit 13 measures, as the access count, the number of writes to the global variable in one module and the number of reads to the global variable in the remaining modules among the plurality of modules for which the access count is to be measured. The dependency strength calculation unit 14 calculates a dependency strength 19 of the remaining modules for the one module via a global variable. The dependency strength 19 is calculated based on the number of writes for the global variable in the one module and the number of reads for the global variable in the remaining modules.

依存強度算出部14は、アクセス回数の計測の対象となる前記複数のモジュールのうち1つのモジュールに対する残余のモジュールの、グローバル変数に関する依存強度19を、前記1つのモジュールにおけるグローバル変数に対する書き込み回数と、残余のモジュールにおけるグローバル変数に対する読込み回数との積として算出する。   The dependency strength calculation unit 14 sets the dependency strength 19 related to the global variable of the remaining modules for one module among the plurality of modules to be subjected to the access count measurement, the number of writes to the global variable in the one module, Calculated as the product of the number of reads for global variables in the remaining modules.

本実施形態においてモジュール間依存強度算出装置10は、コンピュータと、コンピュータにおいて実行されるモジュール間依存強度算出プログラムとによって実現される。モジュール間依存強度算出プログラムは、コンピュータを、ソースコード取得部11、グローバル変数抽出部12、アクセス回数計測部13、および依存強度算出部14として機能させる。コンピュータは、中央処理演算装置(central processing unit, 略称「CPU」)および記憶部とを含む。モジュール間依存強度算出プログラムは、記録媒体にコンピュータに読取り可能に記録された状態で提供される。   In the present embodiment, the inter-module dependency strength calculation apparatus 10 is realized by a computer and an inter-module dependency strength calculation program executed on the computer. The inter-module dependency strength calculation program causes a computer to function as the source code acquisition unit 11, the global variable extraction unit 12, the access count measurement unit 13, and the dependency strength calculation unit 14. The computer includes a central processing unit (abbreviated as “CPU”) and a storage unit. The inter-module dependence strength calculation program is provided in a state where it is recorded on a recording medium so as to be readable by a computer.

第1実施形態において、モジュール間依存強度算出装置10による処理の対象となるのは、複数のモジュールを含むソフトウェアである。ソフトウェアは、複数のモジュールを含み、各モジュールは、プログラミング言語で記載されたソースコード15を含む。ソフトウェアは、プログラミング上の不具合、いわゆるバグが除去されたソフトウェアをも、またバグを含んだ状態の未完成のソフトウェアをも、さらにコーディングの途中であって、全体としての機能が未完成なソフトウェアをも含む。ソフトウェア中のソースコード15は、たとえばC++およびJava(登録商標)などのオブジェクト指向のプログラミング言語で記述されていてもよく、たとえばC言語、Visual Basic、フォートラン、コボルなどの構造化プログラミング言語で記述されていてもよい。   In the first embodiment, the processing target by the inter-module dependence strength calculation apparatus 10 is software including a plurality of modules. The software includes a plurality of modules, and each module includes source code 15 written in a programming language. Software includes software that has been free of programming defects, so-called bugs, software that is incomplete with bugs, and software that is in the middle of coding and whose functions are not yet complete. Including. The source code 15 in the software may be described in an object-oriented programming language such as C ++ and Java (registered trademark), for example, and is described in a structured programming language such as C language, Visual Basic, Fortran, or Kobol. It may be.

ソースコード取得部11は、ソースコードおよびモジュールの対応関係情報16を表す情報と、ソースコード15とを取得することによって、ソースコード15をモジュール単位で取得する。ソースコードおよびモジュールの対応関係情報16は、本実施形態では一覧表の形式で記憶される。以下、ソースコードおよびモジュールの対応関係情報16を表す一覧表を「対応関係リスト」と称することがある。   The source code acquisition unit 11 acquires the source code 15 in units of modules by acquiring information representing the correspondence relationship information 16 between the source code and the module and the source code 15. The source code and module correspondence information 16 is stored in the form of a list in this embodiment. Hereinafter, the list representing the correspondence information 16 of the source code and the module may be referred to as a “correspondence list”.

取得されたソースコード15は、記憶部に記憶される。グローバル変数抽出部12は、複数種類のグローバル変数を各モジュールにおいて抽出し、グローバル変数リスト20を作成する。グローバル変数リスト20は、抽出されたグローバル変数をモジュール毎に一覧表形式として表したリストである。   The acquired source code 15 is stored in the storage unit. The global variable extraction unit 12 extracts a plurality of types of global variables in each module and creates a global variable list 20. The global variable list 20 is a list that shows the extracted global variables in a list form for each module.

アクセス回数計測部13は、ソースコード取得部11によって取得されたソースコードおよびモジュールの対応関係情報16と、ソースコード15と、グローバル変数リスト20とに基づいて、各モジュールにおける各グローバル変数に対するアクセス回数を数える。計測されたアクセス回数は、モジュール毎に、かつグローバル変数の種類毎に数えられ、アクセス情報18として記憶部に記憶される。   Based on the source code and module correspondence information 16 acquired by the source code acquisition unit 11, the source code 15, and the global variable list 20, the access count measurement unit 13 accesses the global variable in each module. Count. The measured number of accesses is counted for each module and for each type of global variable, and is stored in the storage unit as access information 18.

図2は、本発明の第1実施形態に係るモジュール間依存強度算出方法の各工程を表すフローチャートである。第1実施形態におけるモジュール間依存強度算出方法では、前記モジュール間依存強度算出装置10が用いられる。モジュール間依存強度算出方法は、ソースコード取得工程と、グローバル変数抽出工程と、アクセス回数計測工程と、依存強度算出工程とを含む。   FIG. 2 is a flowchart showing each step of the inter-module dependence strength calculation method according to the first embodiment of the present invention. In the inter-module dependency strength calculation method in the first embodiment, the inter-module dependency strength calculation device 10 is used. The inter-module dependency strength calculation method includes a source code acquisition step, a global variable extraction step, an access count measurement step, and a dependency strength calculation step.

ソースコード取得工程では、ソースコード15を、ソースコード取得部11によってモジュール単位で取得する。グローバル変数抽出工程では、グローバル変数をグローバル変数抽出部12によって抽出する。グローバル変数抽出工程で抽出されるグローバル変数は、ソースコード取得工程において取得されたモジュールのうち、少なくとも一部のモジュールのソースコード15に含まれるグローバル変数である。   In the source code acquisition step, the source code 15 is acquired in module units by the source code acquisition unit 11. In the global variable extraction step, the global variable is extracted by the global variable extraction unit 12. The global variables extracted in the global variable extraction process are global variables included in the source code 15 of at least some of the modules acquired in the source code acquisition process.

アクセス回数計測工程では、グローバル変数抽出工程において抽出されたグローバル変数のうち、少なくとも一部のグローバル変数について、アクセス回数を、アクセス回数計測部13によって、グローバル変数毎に計測する。アクセス回数は、複数のモジュールのグローバル変数に対するアクセス回数である。この複数のモジュールは、グローバル変数抽出工程でグローバル変数の抽出の対象となったモジュールのうちの複数のモジュールである。   In the access count measurement process, the access count measurement unit 13 measures the access count for at least some of the global variables extracted in the global variable extraction process for each global variable. The number of accesses is the number of accesses to a global variable of a plurality of modules. The plurality of modules are a plurality of modules among the modules subjected to the extraction of the global variable in the global variable extraction step.

依存強度算出工程では、この複数のモジュール間の依存強度19を、依存強度算出部14によってアクセス回数に基づいてグローバル変数毎に算出する。モジュール間依存強度算出方法において、前記の各工程は、ソースコード取得工程、グローバル変数抽出工程、アクセス回数計測工程および依存強度算出工程の順に行われる。   In the dependency strength calculation step, the dependency strength 19 between the plurality of modules is calculated for each global variable by the dependency strength calculation unit 14 based on the number of accesses. In the inter-module dependency strength calculation method, each of the above steps is performed in the order of a source code acquisition step, a global variable extraction step, an access count measurement step, and a dependency strength calculation step.

図3は、本発明の第1実施形態においてソースコード取得部11によって取得されるソースコード15の一例を表す図である。図3には、第1実施形態におけるソースコード取得部11によって取得されるソースコード15のうちの一部を示しており、第1実施形態において取得されるソースコード15は、さらに多くのモジュールを含むものとする。本実施形態の説明では、C言語で記述した簡易的なソースコード15を入力として与えるものとする。なお、本発明はC言語以外にも、Fortran,C++,Java(登録商標)などグローバル変数を定義可能な言語もしくは実質的にグローバル変数と同等にアクセス可能な変数の定義を行える言語に同様に適用可能である。   FIG. 3 is a diagram illustrating an example of the source code 15 acquired by the source code acquisition unit 11 in the first embodiment of the present invention. FIG. 3 shows a part of the source code 15 acquired by the source code acquisition unit 11 in the first embodiment. The source code 15 acquired in the first embodiment includes more modules. Shall be included. In the description of this embodiment, it is assumed that simple source code 15 written in C language is given as input. In addition to the C language, the present invention is similarly applied to languages that can define global variables such as Fortran, C ++, Java (registered trademark), or languages that can define variables that can be accessed substantially equivalent to global variables. Is possible.

図3において、このソースコード15の構成は、モジュール名「module1」というモジュール301と、モジュール名「module2」というモジュール302とを含み、「module1
」というモジュール301は「M1_S1.c」という名前のソースコード303と「M1_S2.c」という名前のソースコード304とを含み、「module2」というモジュール302は「
M2_S1.c」という名前のソースコード305を含むということを示している。
In FIG. 3, the configuration of the source code 15 includes a module 301 having a module name “module1” and a module 302 having a module name “module2”.
”Includes a source code 303 named“ M1_S1.c ”and a source code 304 named“ M1_S2.c ”, and a module 302 named“ module2 ”
This indicates that the source code 305 named “M2_S1.c” is included.

図2のステップa2においては、ソースコード15として、ソースコード303,304,305の内容がソースコード名とともに取得される。また、ソースコードおよびモジュール対応関係情報16とは、どのソースコード15がどのモジュールに含まれるのかを定義した情報のことであり、たとえば、表1に示した一覧表の形式で取得される。ただし他の実施形態では、ソースコードおよびモジュール対応関係情報16の表し方は、表1に示した一覧表の形式に限定するものではない。ソースコード15を記載した電子データとしてのファイルを、「ソースコードファイル」と称すると、ソースコードファイルが存在するファイルシステム上のフォルダ構成を利用して、あるモジュールの名前の付いたフォルダに含まれるソースコードファイルは全てそのモジュールに含まれるソースコード15として自動的に判別される実施形態も実現可能である。   In step a2 in FIG. 2, the contents of the source codes 303, 304, and 305 are acquired as the source code 15 together with the source code name. The source code and module correspondence information 16 is information that defines which source code 15 is included in which module, and is acquired, for example, in the form of a list shown in Table 1. However, in other embodiments, the way of expressing the source code and module correspondence information 16 is not limited to the format of the list shown in Table 1. When the file as the electronic data describing the source code 15 is referred to as a “source code file”, it is included in a folder with the name of a certain module using the folder structure on the file system where the source code file exists. An embodiment in which all source code files are automatically identified as source code 15 included in the module can be realized.

Figure 2010282441
Figure 2010282441

図4は、本発明の第1実施形態におけるグローバル変数抽出工程の各段階を表すフローチャートである。図2のステップa2において、図1のグローバル変数抽出部12は、ソースコード取得部11からソースコード15を取得し、これを解析して、ソースコード15内に定義されているグローバル変数のリストであるグローバル変数リスト20を生成する。   FIG. 4 is a flowchart showing each stage of the global variable extraction process in the first embodiment of the present invention. In step a2 of FIG. 2, the global variable extraction unit 12 of FIG. 1 acquires the source code 15 from the source code acquisition unit 11, analyzes it, and uses the list of global variables defined in the source code 15 as a list. A global variable list 20 is generated.

図4のステップb1において、入力として与えられた全てのソースコードファイルを開いて解析を行ったかを調べる。全てのソースコードファイルを開いた場合はステップb13に移行し、後述するグローバル変数リスト20を出力する。全てのソースコードファイルをまだ開いていない場合はステップb2に移行し、まだ開いていないソースコードファイルを1つ選択し、それを解析対象として開く。   In step b1 in FIG. 4, it is checked whether all source code files given as inputs have been opened and analyzed. If all source code files have been opened, the process proceeds to step b13, and a global variable list 20 described later is output. If all the source code files have not been opened yet, the process proceeds to step b2, and one source code file that has not been opened is selected and opened as an analysis target.

次にステップb3に移行し、取得を行うソースコード15中の位置についての情報として「関数定義外」または「関数定義内」のいずれかの値をとる情報を「関数定義外」に設定する。「関数定義内」とは、ソースコード15中において関数定義を行っている領域内である、としての情報であり、「関数定義外」とは、ソースコード15中の位置の情報として、関数定義を行っている領域外であるという情報を意味する。次にステップb4に移行し、現在開いているソースコードファイルから、順番に次の1文を取得する。   Next, the process proceeds to step b3, and information that takes one of the values “outside function definition” or “inside function definition” is set to “outside function definition” as information about the position in the source code 15 to be acquired. “In function definition” is information indicating that the function is defined in the source code 15, and “out of function definition” is information regarding the position in the source code 15. It means the information that it is outside the area that is performing. Next, the process proceeds to step b4, and the next one sentence is acquired in order from the currently opened source code file.

次にステップb5に移行し、ステップb4で取得した1文で変数定義が行われているかを判別する。変数定義は通常、図3のソースコード303の第3行や、ソースコード304の第3行のように、「変数の型名 変数名, 変数名, …;」と記載されるので、これを判別する。この判別の結果、変数定義が行われていると判別した場合はステップb6に移行し、変数定義が行われていないと判別した場合はステップb8に移行する。   Next, the process proceeds to step b5, and it is determined whether or not the variable definition is performed in one sentence acquired in step b4. The variable definition is usually described as “variable type name variable name, variable name, ...;” as shown in the third line of the source code 303 in FIG. 3 and the third line of the source code 304. Determine. As a result of the determination, if it is determined that the variable definition is performed, the process proceeds to step b6. If it is determined that the variable definition is not performed, the process proceeds to step b8.

ステップb6において、変数定義が行われている箇所が関数の定義の外かどうか、すなわち、取得を行うソースコード15中の位置についての情報が「関数定義外」かどうかを判別する。ソースコード15中の位置の情報が「関数定義外」の場合は、定義されている変数は関数定義外で定義されている変数、すなわちグローバル変数であると判断される。   In step b6, it is determined whether or not the location where the variable definition is performed is outside the function definition, that is, whether or not the information about the position in the source code 15 to be acquired is “outside the function definition”. When the position information in the source code 15 is “outside function definition”, it is determined that the defined variable is a variable defined outside the function definition, that is, a global variable.

次にステップb7に移行し、グローバル変数と判断された変数をグローバル変数リスト20に追加する。ソースコード15中の位置の情報が「関数定義内」である場合は、定義されている変数はグローバル変数ではないと判断され、次の1文を取得するためにステップb4に移行する。   Next, the process proceeds to step b7, and the variable determined to be a global variable is added to the global variable list 20. When the position information in the source code 15 is “within function definition”, it is determined that the defined variable is not a global variable, and the process proceeds to step b4 in order to obtain the next sentence.

ステップb8では、取得した1文において関数定義の開始の記述があるかを判別する。関数定義の開始は通常、「関数返り値の型 関数名(引数のリスト)」の形式で記述されるので、これを判別することが可能である。この判別の結果、関数定義の開始の記述があると判別した場合は、ステップb9に移行し、ソースコード15中の位置の情報を「関数定義内」に変更して、次の1文を取得するためにステップb4に移行する。ステップb8において、関数定義の開始の記述ではないと判別した場合は、ステップb10に移行する。   In step b8, it is determined whether or not there is a function definition start description in the acquired one sentence. The start of a function definition is usually described in the format of “function return value type function name (argument list)”, so it can be determined. As a result of the determination, if it is determined that there is a description of the start of the function definition, the process proceeds to step b9, the position information in the source code 15 is changed to “within the function definition”, and the next sentence is obtained. Therefore, the process proceeds to step b4. If it is determined in step b8 that the description is not the start of function definition, the process proceeds to step b10.

ステップb10では、取得した1文で関数定義の終了の記述があるかどうかを判別する。関数定義は、たとえばC言語の場合には、「{」と、「}」の間に記述される。このため、関数定義の終了は、ソースコード15中の位置の情報が「関数定義内」であるときの一番外側の閉じ括弧「}」の有無で判別可能である。この判別の結果、関数定義の終了の記述があると判別した場合は、ステップb11において内部状態を「関数定義外」に変更して、次の1文を取得するためにステップb4に移行する。ステップb10において関数定義の終了の記述ではないと判別された場合は、ステップb12に移行する。   In step b10, it is determined whether or not there is a description of the end of the function definition in the acquired one sentence. For example, in the case of C language, the function definition is described between “{” and “}”. Therefore, the end of the function definition can be determined by the presence or absence of the outermost closing parenthesis “}” when the position information in the source code 15 is “within the function definition”. As a result of the determination, if it is determined that there is a description of the end of the function definition, the internal state is changed to “out of function definition” in step b11, and the process proceeds to step b4 to obtain the next sentence. If it is determined in step b10 that the function definition is not ended, the process proceeds to step b12.

ステップb12では、現在開いているソースコードファイルの終わりまで取得したかどうかを判別する。ソースコードファイルの終わりではないと判別した場合は、次の1文を取得するためにステップb4を実行する。ソースコードファイルの終わりと判別した場合は、まだ開いていない別のソースコードファイルを開くためにステップb1に移行する。   In step b12, it is determined whether or not the end of the currently opened source code file has been acquired. If it is determined that it is not the end of the source code file, step b4 is executed to obtain the next sentence. If it is determined that the end of the source code file is reached, the process proceeds to step b1 to open another source code file that has not been opened.

図4に示すグローバル変数抽出工程、すなわち図2のステップa2が終了した後、図2のステップa3のアクセス回数計測工程に移行し、アクセス回数計測部13によって、ソースコード取得部11からソースコード15と、ソースコードおよびモジュール対応関係情報16と、グローバル変数抽出部12からのグローバル変数リスト20とを取得して、表2に例示するような、アクセス情報18を生成する。   After the global variable extraction step shown in FIG. 4, that is, step a2 in FIG. 2 is completed, the process proceeds to the access count measurement step in step a3 in FIG. Then, the source code and module correspondence information 16 and the global variable list 20 from the global variable extraction unit 12 are acquired, and the access information 18 as illustrated in Table 2 is generated.

Figure 2010282441
Figure 2010282441

前述したように、アクセス情報18は、各モジュールのソースコード15に含まれるどのグローバル変数が、何回アクセス、すなわち書き込みまたは読み込みされるか、という情報である。同表の第1行には、ソースコードファイルに含まれるグローバル変数が列挙され、第1列にはソースコードファイルに含まれるモジュールが列挙されている。その他の欄には、モジュール(「M」とする)とグローバル変数(「g」とする)の直交するマスに、モジュール「M」のグローバル変数「g」への書き込み回数「W(M,g)」と、モジュール「M」のグローバル変数「g」の読み込み回数「R(M, g)」が記載されている。   As described above, the access information 18 is information indicating which global variable included in the source code 15 of each module is accessed, that is, written or read. The first row of the table lists global variables included in the source code file, and the first column lists modules included in the source code file. In the other column, the number of times of writing to the global variable “g” of the module “M” “W (M, g” is written in the square where the module (“M”) and the global variable (“g”) are orthogonal to each other. ) ”And the number of reads“ R (M, g) ”of the global variable“ g ”of the module“ M ”.

図5は、本発明の第1実施形態におけるアクセス回数計測工程の各段階を表すフローチャートである。本処理開始後、図5のステップc1において、全てのモジュールについて処理を行ったかどうかを判別する。全てのモジュールについて処理を行った場合は、ステップc11にてアクセス情報18を出力して終了する。全てのモジュールについて処理を行っていない場合は、ステップc2において、まだ処理を行っていないモジュールを選択する。ステップc2で選択されたモジュールを、「モジュールM」とする。   FIG. 5 is a flowchart showing each stage of the access count measurement process in the first embodiment of the present invention. After the start of this process, it is determined in step c1 in FIG. 5 whether or not all modules have been processed. If all modules have been processed, the access information 18 is output in step c11 and the process ends. If all the modules have not been processed, a module that has not yet been processed is selected in step c2. The module selected in step c2 is referred to as “module M”.

次にステップc3では、ステップc2で選択したモジュールMに含まれる全てのソースコードファイルを開いたかどうかを判別する。全てのソースコードファイルを開いた場合は、他のモジュールについて処理をするために、ステップc1に移行する。まだ全てのソースコードファイルを開いていない場合は、ステップc4において、まだ開いていないソースコードファイルを開く。次にステップc5では、現在開いているソースコードファイルから、順番に次の1文を取得する。   Next, in step c3, it is determined whether all the source code files included in the module M selected in step c2 have been opened. If all the source code files have been opened, the process proceeds to step c1 in order to process other modules. If all the source code files have not been opened yet, in step c4, the source code files that have not been opened are opened. Next, in step c5, the next one sentence is acquired in order from the currently opened source code file.

次にステップc6では、取得した1文においてグローバル変数への書き込みが行われているかを判別する。グローバル変数への書き込みは、図3のソースコード304の第7行の左辺のグローバル変数「g_1」のような代入式の左辺にグローバル変数が使われている記述で表される場合もあれば、その他に、「g_1++」および「g_1--」といったインクリメントおよびデクリメントを示す記述で表される場合もある。   Next, in step c6, it is determined whether or not writing to the global variable is performed in the acquired one sentence. The writing to the global variable may be expressed by a description in which the global variable is used on the left side of the assignment expression like the global variable “g_1” on the left side of the seventh line of the source code 304 in FIG. In addition, it may be expressed by a description indicating increment and decrement such as “g_1 ++” and “g_1--”.

グローバル変数(「グローバル変数g」とする)への書き込みが行われている場合は、ステップc7において、アクセス情報18に含まれる、モジュールMのグローバル変数gへの書き込み回数「W(M, g)」に「1」が加算され、次のステップc8に移行する。モジュールMのグローバル変数gへの書き込み回数「W(M, g)」の初期値は零とする。また、グローバル変数への書き込みが行われていない場合もステップc8に移行する。   When writing to the global variable (referred to as “global variable g”) is performed, the number of times “W (M, g) of writing to the global variable g of the module M included in the access information 18 in step c7. "1" is added to "", and the process proceeds to the next step c8. The initial value of the write count “W (M, g)” to the global variable g of the module M is set to zero. Further, the process proceeds to step c8 when the global variable is not written.

ステップc8では、取得した1文においてグローバル変数の読み込みが行われているかを判別する。グローバル変数の読み込みは、たとえば図3のソースコード305の第7行および第11行の右辺のグローバル変数「g_1」のように、代入式の右辺にグローバル変数が使われている記述によって表される場合もある。その他、インクリメント、デクリメント、条件文などで使われる比較演算子のオペランド、関数呼び出しの際の引数、関数の返り値などとして記述される場合もある。   In step c8, it is determined whether the global variable is read in the acquired one sentence. The reading of the global variable is represented by a description in which the global variable is used on the right side of the assignment expression, for example, the global variable “g_1” on the right side of the 7th and 11th lines of the source code 305 in FIG. In some cases. In addition, it may be described as an operand of a comparison operator used in increment, decrement, conditional statements, etc., an argument when calling a function, a return value of a function, etc.

グローバル変数の読み込みが行われている場合は、次のステップc9に移行し、アクセス情報18に含まれる、モジュールMのグローバル変数gの読み込み回数「R(M, g)」に「1」を加算し、次のステップc10に移行する。モジュールMのグローバル変数gの読み込み回数「R( M, g)」の初期値は零とする。また、グローバル変数の読み込みが行われていない場合もステップc10に移行する。   If the global variable has been read, the process proceeds to the next step c9, and “1” is added to the read count “R (M, g)” of the global variable g of the module M included in the access information 18. Then, the process proceeds to the next step c10. The initial value of the read count “R (M, g)” of the global variable g of the module M is set to zero. If the global variable has not been read, the process proceeds to step c10.

ステップc10では、開いているソースコードファイルの終わりまで読み込んだかどうかを判別する。ソースコードファイルの終わりではないと判別した場合は、次の1文を取得するためにステップc5に移行する。ソースコードファイルの終わりと判別した場合は、まだ開いていない別のソースコードファイルを開くためにステップc3に移行する。   In step c10, it is determined whether or not the end of the open source code file has been read. If it is determined that it is not the end of the source code file, the process proceeds to step c5 to obtain the next sentence. If it is determined that the end of the source code file is reached, the process proceeds to step c3 to open another source code file that has not yet been opened.

図6は、本発明の第1実施形態における各グローバル変数の、各モジュールにおけるアクセスの様子を表す図である。図6に一例として表されるアクセス回数は、表2において示した回数に符合する。図6において、モジュールを表す四角(601,602,603)から、グローバル変数を表す楕円(604,605,606)にまで延びる矢符は、各モジュールにおけるグローバル変数への書き込みを表している。グローバル変数を表す楕円(604,605,606)から、モジュールを表す四角(601,602,603)にまで延びる矢符は、各モジュールにおけるグローバル変数の読み込みを表している。   FIG. 6 is a diagram illustrating an access state of each global variable in each module according to the first embodiment of this invention. The number of accesses shown as an example in FIG. 6 matches the number of times shown in Table 2. In FIG. 6, the arrows extending from the squares (601, 602, 603) representing the modules to the ellipses (604, 605, 606) representing the global variables represent writing to the global variables in each module. An arrow extending from an ellipse (604, 605, 606) representing a global variable to a square (601, 602, 603) representing a module represents reading of the global variable in each module.

ソースコード取得部11によって取得されたソースコード15が、グローバル変数抽出部12によるグローバル変数の抽出と、アクセス回数計測部13によるアクセス回数の計測の結果、図6に示すアクセス関係を示す場合に、図4および図5の各ステップを実行することで、表2に示すアクセス情報18が得られる。   When the source code 15 acquired by the source code acquisition unit 11 shows the access relationship shown in FIG. 6 as a result of the global variable extraction by the global variable extraction unit 12 and the access count measurement by the access count measurement unit 13. 4 and 5 is executed, the access information 18 shown in Table 2 is obtained.

図2のステップa2において、図1の依存強度算出部14は、アクセス回数計測部13からアクセス情報18を取得し、モジュール間依存強度19を算出する。モジュール間依存強度19とは、ソースコード15に含まれるモジュール間の依存強度19を定量的に評価したもので、表3に、モジュール間依存強度19の一例を表す。表3には、たとえば「g」とする1つの種類のグローバル変数に関する各モジュール間の依存強度19が示される。   In step a2 of FIG. 2, the dependency strength calculation unit 14 of FIG. 1 acquires the access information 18 from the access count measurement unit 13 and calculates the inter-module dependency strength 19. The inter-module dependency strength 19 is a quantitative evaluation of the inter-module dependency strength 19 included in the source code 15. Table 3 shows an example of the inter-module dependency strength 19. Table 3 shows the dependency strength 19 between modules for one type of global variable, for example, “g”.

Figure 2010282441
Figure 2010282441

表3の第1行と第1列には、ソースコードファイルに含まれるモジュールが列挙されている。その他の欄には、モジュール「module1」の行とモジュール「module2」の列とが直交するマスに、モジュール「module1」に対するモジュール「module2」の依存強度I(M1,
M2)が記載されている。したがって表3は、あるモジュールが他のモジュールにどれだけ影響を与えているか、または、他のモジュールからどれだけ影響を受けているかを表す。
In the first row and the first column of Table 3, modules included in the source code file are listed. In the other columns, the dependency strength I (M1, M1) of the module “module2” with respect to the module “module1” is shown in a square where the row of the module “module1” and the column of the module “module2” are orthogonal to each other.
M2) is described. Therefore, Table 3 shows how much a certain module is affecting other modules or how much it is influenced by other modules.

たとえば、第1行のように、表3を横に見ていった場合は、「module1」が他のモジュールにどれだけ影響を与えているかが分かる。具体的には、「module1」におけるグローバル変数「g」への書き込みが、他のモジュールにおけるグローバル変数「g」の読み込みに対して与える影響が、表3の各行に示される。   For example, as shown in the first row, when looking at Table 3 sideways, it can be seen how much “module1” affects other modules. Specifically, the influence of the writing to the global variable “g” in “module1” on the reading of the global variable “g” in another module is shown in each row of Table 3.

また、表3においてたとえば左方から第2列のように、表を縦に見ていった場合は、「
module1」が他のモジュールからどれだけ影響を受けているかが分かる。具体的には、「
module1」におけるグローバル変数「g」の読み込みが、他のモジュールにおけるグローバル変数「g」への書き込みから付与される影響が、表3の各列に示される。
Also, when looking at the table vertically as shown in the second column from the left in Table 3, for example,
You can see how much module1 is affected by other modules. In particular,"
The influence given by reading the global variable “g” in “module1” from writing to the global variable “g” in other modules is shown in each column of Table 3.

図7は、本発明の第1実施形態における依存強度算出工程の各段階を表すフローチャートである。図7のステップd1において、ソースコードファイルに含まれるモジュールの全ての組み合わせについて処理を行ったかどうかを判別する。全てのモジュールの組み合わせについて処理をした場合は、ステップd9に移行し、モジュール間依存強度を算出結果として出力し、処理を終了する。全てのモジュールの組み合わせについてまだ処理をしていない場合は、ステップd2に移行し、まだ処理を行っていないモジュールの組み合わせを選択する。以下、ステップd2において、モジュール「M1」および「M2」を選択したものとして、図7のステップd3〜d8について説明する。   FIG. 7 is a flowchart showing each stage of the dependency strength calculation process in the first embodiment of the present invention. In step d1 of FIG. 7, it is determined whether or not processing has been performed for all combinations of modules included in the source code file. If all the combinations of modules have been processed, the process proceeds to step d9, the inter-module dependency strength is output as a calculation result, and the process ends. If all the combinations of modules have not been processed yet, the process proceeds to step d2, and a combination of modules not yet processed is selected. Hereinafter, steps d3 to d8 in FIG. 7 will be described assuming that modules “M1” and “M2” are selected in step d2.

ステップd3では、モジュール「M1」および「M2」が書き込みまたは読み込みを行っている共通のグローバル変数について、アクセス情報18からグローバル変数リスト20を生成する。以下、この具体的なグローバル変数リスト20を「list」とする。たとえば表2に示されるアクセス情報18が与えられ、モジュール「M1」および「M2」として表2の「module1」および「module2」が選択されていた場合、表2のアクセス情報18から、「module1」および「module2」において書き込みおよび読み込みが行われる共通のグローバル変数「g_1」および「g_2」について、グローバル変数リスト「list」が生成される。   In step d3, a global variable list 20 is generated from the access information 18 for the common global variables that are written or read by the modules “M1” and “M2”. Hereinafter, this specific global variable list 20 is referred to as “list”. For example, when the access information 18 shown in Table 2 is given and “module 1” and “module 2” in Table 2 are selected as the modules “M1” and “M2”, the “module 1” is obtained from the access information 18 in Table 2. And a global variable list “list” is generated for the common global variables “g_1” and “g_2” written and read in “module2”.

次にステップd4に移行し、「list」にある全てのグローバル変数について処理を行ったかどうかを判別する。「list」にある全てのグローバル変数について処理を行った場合は、別のモジュールの組み合わせについて処理を行うためにdステップd1を実行する。「list」にある全てのグローバル変数についてまだ処理を行っていない場合はステップd5に移行する。   Next, the process proceeds to step d4, where it is determined whether or not all global variables in “list” have been processed. When processing has been performed for all global variables in “list”, d step d1 is executed to perform processing for another combination of modules. If all the global variables in “list” have not yet been processed, the process proceeds to step d5.

ステップd5では、「list」から、まだ処理を行っていないグローバル変数を順次1つ取得する。ステップd5で取り出された具体的なグローバル変数を、たとえば「g」とすると、次のステップd6では、アクセス情報18から、モジュール「M1」と「M2」とにおけるグローバル変数「g」への読み込み回数および書き込み回数である、「R(M1, g)」、「R(M2, g)」、「W(M1, g)」および「W(M2, g)」を取得する。   In step d5, one global variable that has not yet been processed is sequentially acquired from “list”. If the specific global variable extracted in step d5 is “g”, for example, in the next step d6, the number of readings from the access information 18 to the global variable “g” in the modules “M1” and “M2”. Then, “R (M1, g)”, “R (M2, g)”, “W (M1, g)”, and “W (M2, g)” are acquired.

次のステップd7では、モジュール「M1」のグローバル変数「g」への書き込み回数「
W(M1, g)」と、モジュール「M2」のグローバル変数「g」の読み込み回数「R(M2, g)」との積をモジュール「M1」に対するモジュール「M2」の依存強度「I(M1, M2)」に加算する。モジュール「M1」に対するモジュール「M2」の依存強度「I(M1, M2)」の初期値は零とする。
In the next step d7, the number of times of writing to the global variable “g” of the module “M1” “
The product of W (M1, g) ”and the number of reads“ R (M2, g) ”of global variable“ g ”of module“ M2 ”is the dependency strength of module“ M2 ”with respect to module“ M1 ”“ I (M1 , M2) ”. The initial value of the dependency strength “I (M1, M2)” of the module “M2” with respect to the module “M1” is zero.

「W(M1, g)」と「R(M2, g)」との積は、モジュール「M1」がグローバル変数「g」に書き込む回数が多いほど、また、モジュール「M2」がグローバル変数「g」を読み込む回数が多いほど大きな値となる。モジュール「M1」におけるグローバル変数「g」への書き込みの回数が、仮に2倍になれば、グローバル変数「g」を読み込むモジュール「M2」への影響は2倍に増大する。仮にモジュール「M2」におけるグローバル変数「g」の読み込みの回数が、仮に2倍になれば、グローバル変数「g」に書き込むモジュール「M1」からモジュール「M2」が受ける影響は2倍に増大する。したがって、「W(M1, g)」と「R(M2, g)」との積を求めることによって、モジュール「M1」がグローバル変数「g」に与えた影響による、モジュール「M2」がグローバル変数「g」を介して受けた影響の度合いを評価することができる。   The product of “W (M1, g)” and “R (M2, g)” indicates that the more times module “M1” writes to global variable “g”, the more module “M2” has global variable “g” The larger the number of times “is read, the larger the value. If the number of writes to the global variable “g” in the module “M1” is doubled, the influence on the module “M2” that reads the global variable “g” is doubled. If the number of times of reading of the global variable “g” in the module “M2” is doubled, the influence of the module “M2” from the module “M1” written to the global variable “g” is doubled. Therefore, by finding the product of “W (M1, g)” and “R (M2, g)”, module “M2” is a global variable due to the effect of module “M1” on global variable “g”. The degree of influence received through “g” can be evaluated.

次にステップd8に移行し、モジュール「M2」のグローバル変数「g」への書き込み回数「W(M2, g)」と、モジュール「M1」のグローバル変数「g」の読み込み回数「R(M1, g)」の積を、モジュール「M2」に対するモジュール「M1」の依存強度「I(M2, M1)」に加算する。モジュール「M2」に対するモジュール「M1」の依存強度「I(M2, M1)」の初期値は零とする。表2に示すアクセス情報18が与えられた場合、図7の各ステップを実行することで、表3に示すモジュール間依存強度19が得られる。   Next, the process proceeds to step d8, where the number of writes “W (M2, g)” to the global variable “g” of the module “M2” and the number of reads “R (M1, g1) of the global variable“ g ”of the module“ M1 ”are performed. g) ”is added to the dependency strength“ I (M2, M1) ”of the module“ M1 ”with respect to the module“ M2 ”. The initial value of the dependency strength “I (M2, M1)” of the module “M1” with respect to the module “M2” is zero. When the access information 18 shown in Table 2 is given, the inter-module dependency strength 19 shown in Table 3 is obtained by executing the steps of FIG.

第1実施形態によれば、アクセス回数計測部13は、グローバル変数抽出部12によって抽出されたグローバル変数のうち、少なくとも一部のグローバル変数について、アクセス回数をグローバル変数毎に求める。アクセス回数は、複数のモジュールにおけるグローバル変数に対するアクセス回数である。依存強度算出部14は、この複数のモジュール間の依存強度19を、アクセス回数に基づいてグローバル変数毎に算出する。   According to the first embodiment, the access count measurement unit 13 obtains the access count for each global variable for at least some of the global variables extracted by the global variable extraction unit 12. The number of accesses is the number of accesses to a global variable in a plurality of modules. The dependency strength calculation unit 14 calculates the dependency strength 19 between the plurality of modules for each global variable based on the number of accesses.

これによって、モジュールのソースコード15に複数種類のグローバル変数が用いられ、複数のモジュールが、複数のグローバル変数を介して関係している場合にも、複数のモジュール間の依存強度19を算出することができる。したがって、クラスをサポートしていない非オブジェクト指向のプログラミング言語で作成されたソフトウェアについても、モジュール間の依存強度19を定量的に評価することができる。   As a result, even when a plurality of types of global variables are used in the module source code 15 and the plurality of modules are related via the plurality of global variables, the dependency strength 19 between the plurality of modules is calculated. Can do. Therefore, the dependency strength 19 between modules can be quantitatively evaluated even for software created in a non-object-oriented programming language that does not support classes.

これによって、汎用性の高いモジュール間依存強度算出装置10を実現することができる。またこれによって、ソースコード15をモジュール単位で含むソフトウェアを開発するときに、モジュール間の依存関係が複雑化しているモジュールを見つけ出すことができる。したがって、モジュール間の依存関係の複雑化によるソフトウェア開発において、ソフトウェアの保守性低下の可能性を抑制することが可能となる。   Thereby, the inter-module dependence strength calculation apparatus 10 with high versatility can be realized. In addition, this makes it possible to find a module whose dependency relationship between modules is complicated when developing software including the source code 15 in module units. Therefore, it is possible to suppress the possibility of a decrease in software maintainability in software development due to the complicated dependency between modules.

また第1実施形態によれば、依存強度算出部14は、1つのモジュールに対する残余のモジュールの、グローバル変数を介する依存強度19を算出する。この依存強度19は、前記1つのモジュールにおけるグローバル変数に対する書き込み回数と、残余のモジュールにおけるグローバル変数に対する読み込み回数とに基づいて算出する。   Further, according to the first embodiment, the dependency strength calculating unit 14 calculates the dependency strength 19 via the global variable of the remaining modules for one module. The dependency strength 19 is calculated based on the number of writes for the global variable in the one module and the number of reads for the global variable in the remaining modules.

これによって、複数のモジュールのうち1つのモジュールに対する残余のモジュールの依存強度19を、グローバル変数に関して算出することができる。したがって、複数のモジュール間における影響の大きさを、グローバル変数を介して影響する側のモジュールと影響される側のモジュールとを区別して、定量的に評価することができる。   Thereby, the dependency strength 19 of the remaining module with respect to one module among the plurality of modules can be calculated with respect to the global variable. Therefore, the magnitude of the influence between the plurality of modules can be quantitatively evaluated by distinguishing the module on the influence side from the module on the influence side via the global variable.

また第1実施形態によれば、依存強度算出部14は、アクセス回数の計測の対象となる前記複数のモジュールのうち1つのモジュールに対する残余のモジュールの、グローバル変数に関する依存強度19を、前記1つのモジュールにおけるグローバル変数に対する書き込み回数と、残余のモジュールにおけるグローバル変数に対する読込み回数との積として算出する。これによって、モジュール間の影響を、書き込み回数と読込み回数とに応じて定量的に評価することができる。   Further, according to the first embodiment, the dependency strength calculating unit 14 calculates the dependency strength 19 related to the global variable of the remaining modules for one module among the plurality of modules to be subjected to the access count measurement. It is calculated as the product of the number of writes for the global variable in the module and the number of reads for the global variable in the remaining modules. Thereby, the influence between modules can be evaluated quantitatively according to the number of times of writing and the number of times of reading.

グローバル変数に対して書き込みを行うモジュールは、このグローバル変数を読込む他のモジュールに影響を与え、その影響の度合は、書き込み回数および読込み回数が多くなればなるほど大きくなるしたがって、1つのモジュールに対する残余のモジュールによる影響を、書き込み回数と読込み回数とに応じて定量的に評価することができる。   A module that writes to a global variable affects other modules that read this global variable, and the degree of the effect increases as the number of writes and reads increases, so the remaining for one module Can be quantitatively evaluated according to the number of times of writing and the number of times of reading.

また第1実施形態によれば、アクセス回数計測工程では、少なくとも一部のグローバル変数について、アクセス回数を、アクセス回数計測部13によって、グローバル変数毎に計測する。依存強度算出工程では、複数のモジュール間の依存強度19を、依存強度算出部14によってアクセス回数に基づいてグローバル変数毎に算出する。   Further, according to the first embodiment, in the access count measuring step, the access count is measured for each global variable by the access count measuring section 13 for at least some of the global variables. In the dependency strength calculation step, the dependency strength 19 between the plurality of modules is calculated for each global variable by the dependency strength calculation unit 14 based on the number of accesses.

これによって、モジュールのソースコード15に複数種類のグローバル変数が用いられ、複数のモジュールが、複数のグローバル変数を介して関係している場合にも、複数のモジュール間の依存強度19を算出することができる。したがって、クラスをサポートしていない非オブジェクト指向のプログラミング言語で作成されたソフトウェアについても、モジュール間の依存強度19を定量的に評価することができる。これによって、汎用性の高いモジュール間依存強度算出装置10を実現することができる。   As a result, even when a plurality of types of global variables are used in the module source code 15 and the plurality of modules are related via the plurality of global variables, the dependency strength 19 between the plurality of modules is calculated. Can do. Therefore, the dependency strength 19 between modules can be quantitatively evaluated even for software created in a non-object-oriented programming language that does not support classes. Thereby, the inter-module dependence strength calculation apparatus 10 with high versatility can be realized.

またこれによって、ソースコード15をモジュール単位で含むソフトウェアを開発するときに、モジュール間の依存関係が複雑化しているモジュールを見つけ出すことができる。したがって、モジュール間の依存関係の複雑化によるソフトウェア開発において、ソフトウェアの保守性低下の可能性を抑制することが可能となる。   In addition, this makes it possible to find a module whose dependency relationship between modules is complicated when developing software including the source code 15 in module units. Therefore, it is possible to suppress the possibility of a decrease in software maintainability in software development due to the complicated dependency between modules.

また第1実施形態によれば、モジュール間依存強度算出プログラムは、コンピュータを、ソースコード取得部11、グローバル変数抽出部12、アクセス回数計測部13、および依存強度算出部14として機能させる。これによって、コンピュータをモジュール間依存強度算出装置10として機能させることができる。モジュール間依存強度算出プログラムは、記録媒体に記録された状態でコンピュータに提供され、記録媒体には、モジュール間依存強度算出プログラムが、コンピュータに読取り可能に記録される。これによって、前記モジュール間依存強度算出プログラムを、コンピュータに読み取り可能な記録媒体によって提供することができる。   Further, according to the first embodiment, the inter-module dependency strength calculation program causes the computer to function as the source code acquisition unit 11, the global variable extraction unit 12, the access count measurement unit 13, and the dependency strength calculation unit 14. As a result, the computer can function as the inter-module dependence strength calculation device 10. The inter-module dependence strength calculation program is provided to the computer in a state recorded on a recording medium, and the inter-module dependence strength calculation program is recorded on the recording medium so as to be readable by the computer. Thus, the inter-module dependence strength calculation program can be provided by a computer-readable recording medium.

(第2実施形態)
第2実施形態に係るモジュール間依存強度算出装置10は、第1実施形態に係るモジュール間依存強度算出装置10に類似しており、以下、第1実施形態に対する第2実施形態の相違点を中心に説明する。第2実施形態におけるアクセス回数計測部13は、2つのモジュールのソースコード15に含まれる全てのグローバル変数について、この2つのモジュールにおけるグローバル変数に対するアクセス回数を、グローバル変数毎に計測する。2つのモジュールは、グローバル変数抽出部12によってグローバル変数が抽出されたモジュールのうちの、2つのモジュールである。依存強度算出部14は、前記2つのモジュールのうち一方のモジュールに対する他方のモジュールの総合依存強度を算出する。総合依存強度は、一方のモジュールに対する他方のモジュールの依存強度19が、これら2つのモジュールのソースコード15に含まれる全てのグローバル変数に関して合計されることによって求まる。
(Second Embodiment)
The inter-module dependency strength calculation device 10 according to the second embodiment is similar to the inter-module dependency strength calculation device 10 according to the first embodiment, and hereinafter, the differences between the second embodiment and the first embodiment are mainly described. Explained. The access count measurement unit 13 in the second embodiment measures the number of accesses to global variables in the two modules for each global variable for all global variables included in the source code 15 of the two modules. The two modules are two of the modules from which global variables are extracted by the global variable extraction unit 12. The dependency strength calculation unit 14 calculates the total dependency strength of the other module with respect to one of the two modules. The overall dependency strength is obtained by summing the dependency strength 19 of the other module with respect to one module with respect to all global variables included in the source code 15 of these two modules.

これによって、一方のモジュールと他方のモジュールとの影響を、これら2つのモジュールのソースコード15に含まれる全てのグローバル変数に関して総合的に評価することができる。これによって、ソースコード15をモジュール単位で含むソフトウェアを開発するときに、モジュール間の依存関係が複雑化しているモジュールを見つけ出すことができる。したがって、ソフトウェアの開発において、ソフトウェアの保守性低下の可能性を抑制することができる。   Thus, the influence of one module and the other module can be comprehensively evaluated with respect to all global variables included in the source code 15 of these two modules. As a result, when developing software including the source code 15 in module units, it is possible to find a module having a complicated dependency relationship between modules. Therefore, in software development, the possibility of software maintainability degradation can be suppressed.

(第3実施形態)
第3実施形態に係るモジュール間依存強度算出装置10は、第1実施形態に係るモジュール間依存強度算出装置10に類似しており、以下、第1実施形態に対する第3実施形態の相違点を中心に説明する。第3実施形態に係るモジュール間依存強度算出装置10は、モジュール表示部と、入力部とをさらに含む。モジュール表示部は、グローバル変数抽出部12によってグローバル変数が抽出されたモジュールを表示する。入力部は、モジュール表示部に表示されたモジュールのうち、選択された複数のモジュールを示す情報と、選択された複数のモジュールのうちの少なくとも1つを示す情報との入力に用いられる。依存強度算出部14は、前記選択された複数のモジュール内において、前記少なくとも1つのモジュールに対する残余のモジュールの総合依存強度を算出する。
(Third embodiment)
The inter-module dependency strength calculation device 10 according to the third embodiment is similar to the inter-module dependency strength calculation device 10 according to the first embodiment, and hereinafter, the differences between the third embodiment and the first embodiment are mainly described. Explained. The inter-module dependence strength calculation apparatus 10 according to the third embodiment further includes a module display unit and an input unit. The module display unit displays the module from which the global variable is extracted by the global variable extraction unit 12. The input unit is used to input information indicating a plurality of selected modules among the modules displayed on the module display unit and information indicating at least one of the plurality of selected modules. The dependency strength calculation unit 14 calculates the overall dependency strength of the remaining modules with respect to the at least one module in the selected plurality of modules.

モジュール表示部は、たとえば液晶モニタなどの表示装置によって実現される。モジュール表示部の表示画面に、複数のグローバル変数が表示された状態で、モジュール間依存強度算出装置10の操作者は、複数のグローバル変数のうちの一部のグローバル変数を選択可能である。選択されるグローバル変数は、複数選択可能であるものとする。さらに、別蘭としてまたは切換えられた表示画面上において、1つのモジュールを選択する。   The module display unit is realized by a display device such as a liquid crystal monitor. In a state where a plurality of global variables are displayed on the display screen of the module display unit, the operator of the inter-module dependence strength calculating apparatus 10 can select some of the global variables. It is assumed that a plurality of selected global variables can be selected. Further, one module is selected as a separate display or on the switched display screen.

モジュール間依存強度算出装置10は、操作者による複数のモジュールおよびこのうちの1つのモジュールの入力が終了すれば、自動的にモジュール間の総合依存強度の算出を行う。1つのモジュールを選択し入力する作業を、操作者によって、複数回繰り返せば、複数のモジュールのそれぞれに対する、他のモジュールの総合依存強度を算出することもできる。   The inter-module dependence strength calculation device 10 automatically calculates the total dependence strength between modules when the operator finishes inputting a plurality of modules and one of them. If the operation of selecting and inputting one module is repeated a plurality of times by the operator, the total dependence strength of the other modules for each of the plurality of modules can be calculated.

このような構成とすることによって、モジュール表示部を確認しながら、入力部を操作することによって、選択された複数のモジュールの情報を入力することができる。また選択された複数のモジュールのうち少なくとも1つのモジュールを示す情報を、入力部を介して入力することができる。これによって、少なくとも1つのモジュールに対する残余のモジュールの総合依存強度を、選択された範囲の複数のモジュールに注目して算出させることができる。したがって、ソフトウェアを開発するときに、モジュール間の依存関係が複雑化しているモジュールを、選択された複数のモジュールの範囲内において見つけ出すことができる。これによって、複数のモジュールについて総当り的にモジュール間依存強度19を求める場合に比べて、モジュール間の依存関係が複雑化しているモジュールを、迅速に見つけ出すことができる。   With such a configuration, it is possible to input information of a plurality of selected modules by operating the input unit while checking the module display unit. Further, information indicating at least one module among the plurality of selected modules can be input via the input unit. Accordingly, the overall dependence strength of the remaining modules with respect to at least one module can be calculated by paying attention to a plurality of modules in the selected range. Therefore, when developing software, a module having a complicated dependency relationship between modules can be found within a range of a plurality of selected modules. As a result, it is possible to quickly find a module in which the dependency relationship between the modules is complicated as compared with the case where the inter-module dependency strength 19 is obtained for all the modules.

(変形例)
第1実施形態では、依存強度19の算出の対象となるモジュールは、「module1」〜「
module3」の3つである場合を例示したけれども、3つに限定するものではない。依存強度19の算出の対象となるモジュールは、2以上の整数に対応する個数であればよい。依存強度19の算出の対象となるモジュールは、グローバル変数抽出部12においてグローバル変数の抽出の対象となったモジュールのうちの、一部であってもよく、また全部であってもよい。
(Modification)
In the first embodiment, modules for which the dependency strength 19 is calculated are “module1” to “module1”.
Although the case of three of “module3” is illustrated, it is not limited to three. The number of modules corresponding to the calculation of the dependency strength 19 may be any number corresponding to an integer of 2 or more. The modules for which the dependency strength 19 is to be calculated may be a part or all of the modules from which global variables are extracted by the global variable extraction unit 12.

また第1および第3実施形態では、依存強度算出部14による依存強度19の算出に関係するグローバル変数は、グローバル変数抽出部12によって抽出されたグローバル変数のうちの、一部であってもよく、また全部であってもよい。また依存強度算出部14による依存強度19の算出では、アクセス回数計測部13によって計測したアクセス回数をすべて利用することも、また一部のみを利用することも、可能である。   In the first and third embodiments, the global variable related to the calculation of the dependency strength 19 by the dependency strength calculation unit 14 may be a part of the global variables extracted by the global variable extraction unit 12. Or all of them. In calculating the dependency strength 19 by the dependency strength calculation unit 14, it is possible to use all of the access counts measured by the access count measurement unit 13 or only a part of them.

また第1〜第3実施形態において、グローバル変数抽出部12によるグローバル変数の抽出の対象となるモジュールは、ソースコード15を取得したモジュールのうちの一部であってもよく、また全部であってもよい。   In the first to third embodiments, the global variable extraction module 12 may be a part of the module from which the source code 15 has been acquired, or all of the modules. Also good.

また第1から第3実施形態において、モジュール依存強度算出装置による依存強度算出の対象となるソフトウェアを、実行させなければ得られない情報については、無視することができる。たとえば、配列変数の定義において、配列変数の個数の上限が定義されていない配列変数、インデックス変数を参照するグローバル変数、ポインタの値が変更される静的変数のポインタなどは、ソフトウェアの実行の度に具体的な値が変更となりうるものなので、モジュール間依存強度算出装置10では、無視する。ポインタで示されているアドレスが変更されないことを前提とするソフトウェアについては、複数のモジュールにおいて共通して参照するポインタは、グローバル変数として取り扱うことができる。   Further, in the first to third embodiments, information that cannot be obtained unless the software that is the target of the dependency strength calculation by the module dependency strength calculation device is executed can be ignored. For example, in the definition of an array variable, an array variable for which the upper limit of the number of array variables is not defined, a global variable that refers to an index variable, a pointer to a static variable whose pointer value is changed, etc. Since the specific value can be changed, the inter-module dependence strength calculation apparatus 10 ignores it. For software that assumes that the address indicated by the pointer is not changed, a pointer that is commonly referenced in a plurality of modules can be handled as a global variable.

10 モジュール間依存強度算出装置
11 ソースコード取得部
12 グローバル変数抽出部
13 アクセス回数計測部
14 依存強度算出部
15 ソースコード
16 対応関係情報
18 アクセス情報
19 依存強度
20 グローバル変数リスト
DESCRIPTION OF SYMBOLS 10 Inter-module dependence intensity | strength calculation apparatus 11 Source code acquisition part 12 Global variable extraction part 13 Access frequency measurement part 14 Dependence intensity calculation part 15 Source code 16 Correspondence relation information 18 Access information 19 Dependency intensity 20 Global variable list

Claims (6)

ソースコードをモジュール単位で取得するソースコード取得部と、
前記ソースコード取得部によって取得されたモジュールのうち、少なくとも一部のモジュールのソースコードに含まれるグローバル変数を抽出するグローバル変数抽出部と、
前記グローバル変数抽出部によって抽出されたグローバル変数のうち、少なくとも一部のグローバル変数について、前記少なくとも一部のモジュールのうち複数のモジュールにおける前記グローバル変数に対するアクセス回数を、前記グローバル変数毎に計測するアクセス回数計測部と、
前記アクセス回数計測部によってアクセス回数が計測された前記複数のモジュール間の依存強度を、前記アクセス回数に基づいてグローバル変数毎に算出する依存強度算出部とを含むことを特徴とするモジュール間依存強度算出装置。
A source code acquisition unit for acquiring source code in module units;
A global variable extraction unit that extracts global variables included in the source code of at least some of the modules acquired by the source code acquisition unit;
Access for measuring, for each global variable, the number of accesses to the global variable in a plurality of modules among the at least some of the global variables extracted by the global variable extraction unit. Counting unit,
A dependency strength calculating unit that calculates a dependency strength between the plurality of modules whose access count is measured by the access count measuring unit for each global variable based on the access count. Calculation device.
前記アクセス回数計測部は、アクセス回数の計測の対象となる前記複数のモジュールのうち、1つのモジュールにおける前記グローバル変数に対する書き込み回数と、残余のモジュールにおける前記グローバル変数に対する読み込み回数とを、アクセス回数として計測し、
前記依存強度算出部は、前記1つのモジュールに対する残余のモジュールの、グローバル変数を介する依存強度を、前記1つのモジュールにおける前記グローバル変数に対する書き込み回数と、残余のモジュールにおける前記グローバル変数に対する読み込み回数とに基づいて算出することを特徴とする請求項1に記載のモジュール間依存強度算出装置。
The access count measurement unit, as the number of accesses, sets the number of writes to the global variable in one module and the number of reads to the global variable in the remaining modules among the plurality of modules to be subjected to access count measurement. Measure and
The dependency strength calculation unit sets the dependency strength of the remaining modules for the one module via the global variable to the number of writes to the global variable in the one module and the number of reads to the global variable in the remaining module. The inter-module dependence strength calculating apparatus according to claim 1, wherein the inter-module dependent strength calculating apparatus calculates the inter-module dependence strength.
前記依存強度算出部は、前記複数のモジュールのうち1つのモジュールに対する残余のモジュールの、グローバル変数に関する依存強度を、前記1つのモジュールにおける前記グローバル変数に対する書き込み回数と、残余のモジュールにおける前記グローバル変数に対する読み込み回数との積として算出することを特徴とする請求項2に記載のモジュール間依存強度算出装置。   The dependency strength calculation unit is configured to determine the dependency strength of a remaining module for one module among the plurality of modules with respect to the global variable, the number of times of writing to the global variable in the one module, and the global variable in the remaining module. The inter-module dependence strength calculation apparatus according to claim 2, wherein the calculation is performed as a product of the number of reading times. 前記アクセス回数計測部は、前記グローバル変数抽出部によってグローバル変数が抽出された前記少なくとも一部のモジュールのうち、2つのモジュールのソースコードに含まれる全てのグローバル変数について、前記2つのモジュールにおける前記グローバル変数に対するアクセス回数を、前記グローバル変数毎に計測し、
前記依存強度算出部は、前記2つのモジュールのうち一方のモジュールに対する他方のモジュールの総合依存強度であって、
一方のモジュールに対する他方のモジュールの依存強度が、これら2つのモジュールのソースコードに含まれる全てのグローバル変数に関して合計されることによって求まる総合依存強度を算出することを特徴とする請求項1〜3のいずれか1つに記載のモジュール間依存強度算出装置。
The access frequency measurement unit may include the global variables in the two modules for all global variables included in the source code of two modules among the at least some modules from which the global variables are extracted by the global variable extraction unit. Measure the number of accesses to the variable for each global variable,
The dependence strength calculating unit is a total dependence strength of the other module with respect to one of the two modules,
The total dependency strength obtained by summing the dependency strength of the other module with respect to one module with respect to all global variables included in the source code of these two modules is calculated. The inter-module dependence strength calculation apparatus according to any one of the above.
請求項1〜4のいずれか1つに記載のモジュール間依存強度算出装置を用い、
ソースコードを前記ソースコード取得部によってモジュール単位で取得するソースコード取得工程と、
前記ソースコード取得工程において取得されたモジュールのうち、少なくとも一部のモジュールのソースコードに含まれるグローバル変数を前記グローバル変数抽出部によって抽出するグローバル変数抽出工程と、
前記グローバル変数抽出工程において抽出されたグローバル変数のうち、少なくとも一部のグローバル変数について、前記少なくとも一部のモジュールのうち複数のモジュールにおける前記グローバル変数に対するアクセス回数を、前記アクセス回数計測部によって前記グローバル変数毎に計測するアクセス回数計測工程と、
前記アクセス回数計測工程においてアクセス回数が計測された前記複数のモジュール間の依存強度を、前記依存強度算出部によって前記アクセス回数に基づいてグローバル変数毎に算出する依存強度算出工程とを含むことを特徴とするモジュール間依存強度算出方法。
Using the inter-module dependence strength calculation device according to any one of claims 1 to 4,
A source code obtaining step of obtaining source code in module units by the source code obtaining unit;
Of the modules acquired in the source code acquisition step, a global variable extraction step of extracting global variables included in the source code of at least some modules by the global variable extraction unit;
Of the global variables extracted in the global variable extraction step, for at least some of the global variables, the number of accesses to the global variables in a plurality of modules of the at least some of the modules is determined by the access count measurement unit. Access count measurement process to measure for each variable,
A dependency strength calculation step of calculating, for each global variable, the dependency strength between the plurality of modules whose access count has been measured in the access count measurement step based on the access count by the dependency strength calculation unit. The inter-module dependency strength calculation method.
コンピュータを、
ソースコードをモジュール単位で取得するソースコード取得部、
前記ソースコード取得部によって取得されたモジュールのうち、少なくとも一部のモジュールのソースコードに含まれるグローバル変数を抽出するグローバル変数抽出部、
前記グローバル変数抽出部によって抽出されたグローバル変数のうち、少なくとも一部のグローバル変数について、前記少なくとも一部のモジュールのうち複数のモジュールにおける前記グローバル変数に対するアクセス回数を、前記グローバル変数毎に計測するアクセス回数計測部、および
前記アクセス回数計測部によってアクセス回数が計測された前記複数のモジュール間の依存強度を、前記アクセス回数に基づいてグローバル変数毎に算出する依存強度算出部として機能させることを特徴とするモジュール間依存強度算出プログラム。
Computer
Source code acquisition unit that acquires source code in module units,
A global variable extraction unit that extracts global variables included in the source code of at least some of the modules acquired by the source code acquisition unit;
Access for measuring, for each global variable, the number of accesses to the global variable in a plurality of modules among the at least some of the global variables extracted by the global variable extraction unit. A frequency measurement unit, and a dependency strength calculation unit that calculates the dependence strength between the plurality of modules whose access count is measured by the access count measurement unit for each global variable based on the access count. Inter-module dependency strength calculation program.
JP2009135526A 2009-06-04 2009-06-04 Apparatus for calculating inter-module dependent strength, method and program for measuring inter-module dependent strength Pending JP2010282441A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2009135526A JP2010282441A (en) 2009-06-04 2009-06-04 Apparatus for calculating inter-module dependent strength, method and program for measuring inter-module dependent strength

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2009135526A JP2010282441A (en) 2009-06-04 2009-06-04 Apparatus for calculating inter-module dependent strength, method and program for measuring inter-module dependent strength

Publications (1)

Publication Number Publication Date
JP2010282441A true JP2010282441A (en) 2010-12-16

Family

ID=43539108

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2009135526A Pending JP2010282441A (en) 2009-06-04 2009-06-04 Apparatus for calculating inter-module dependent strength, method and program for measuring inter-module dependent strength

Country Status (1)

Country Link
JP (1) JP2010282441A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2015230582A (en) * 2014-06-05 2015-12-21 株式会社日立製作所 Program visualization device, program visualization method, and program visualization program
JP2016076080A (en) * 2014-10-06 2016-05-12 三菱電機株式会社 Source code analyzing apparatus, source code analyzing method, and program
CN107219841A (en) * 2017-05-27 2017-09-29 深圳市沃特沃德股份有限公司 Attribute access control method and device
WO2020261487A1 (en) * 2019-06-27 2020-12-30 オムロン株式会社 Analysis device, analysis method, and analysis program

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2015230582A (en) * 2014-06-05 2015-12-21 株式会社日立製作所 Program visualization device, program visualization method, and program visualization program
JP2016076080A (en) * 2014-10-06 2016-05-12 三菱電機株式会社 Source code analyzing apparatus, source code analyzing method, and program
CN107219841A (en) * 2017-05-27 2017-09-29 深圳市沃特沃德股份有限公司 Attribute access control method and device
WO2018218871A1 (en) * 2017-05-27 2018-12-06 深圳市沃特沃德股份有限公司 Attribute access control method, device and vehicle-mounted control system
WO2020261487A1 (en) * 2019-06-27 2020-12-30 オムロン株式会社 Analysis device, analysis method, and analysis program

Similar Documents

Publication Publication Date Title
US9027002B2 (en) Method of converting source code and source code conversion program
CN103235759B (en) Method for generating test case and device
US20160292068A1 (en) Code coverage rate determination method and system
US8867848B2 (en) Display test device, display test method, and storage medium
CN105446874B (en) A kind of detection method and device of resource distribution file
US20080244536A1 (en) Evaluating static analysis results using code instrumentation
US20100274520A1 (en) Creation of test plans
EP2238540A1 (en) Selective code instrumentation for software verification
US11544176B1 (en) Systems and methods for automatically assessing and conforming software development modules to accessibility guidelines in real-time
US20120185669A1 (en) Program inspection method and non-transitory, computer readable storage medium storing inspection program
JP2010282441A (en) Apparatus for calculating inter-module dependent strength, method and program for measuring inter-module dependent strength
JP2013218492A (en) Software test automatic evaluation device and method
US8464103B2 (en) Generating a functional coverage model from a trace
CN112256575A (en) Code quality management method, system and related equipment
CN105912452A (en) Automated data analysis method and device
JP2005339204A (en) Information processor, and program testing method
JP5811978B2 (en) Test case generation apparatus and test case generation method for model-based control apparatus
CN111143220B (en) Training system and method for software test
JP5121891B2 (en) Rule inspection device, rule inspection method and rule inspection program
US20050235266A1 (en) System and method for business rule identification and classification
CN112631852A (en) Macro checking method, macro checking device, electronic equipment and computer readable storage medium
JP5264866B2 (en) Design document inspection apparatus, design document inspection system, design document inspection program, and design document inspection method for design document inspection apparatus
CN111858377A (en) Quality evaluation method and device for test script, electronic device and storage medium
JP6812637B2 (en) Programmable controller system, its development support device, target device
JP6841667B2 (en) Software performance measurement system and program