Method of Coupling Metrics For Object-Oriented Sof
Method of Coupling Metrics For Object-Oriented Sof
Research Article
Method of Coupling Metrics for Object-Oriented Software System
Based on CSBG Approach
Aihua Gu ,1 Lu Li,1 Shujun Li,1 Qifeng Xun,1 Jian Dong,1 and Jianhong Lin2
1
School of Information Engineering, Yancheng Teachers University, Yancheng 224002, China
2
Zhejiang Ponshine Information Technology Co., Ltd., Hangzhou 310012, China
Copyright © 2020 Aihua Gu et al. This is an open access article distributed under the Creative Commons Attribution License,
which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.
Context. Coupling between classes is an important metric for software complexity in software systems. Objective. In order to
overcome the shortcomings of the existing coupling methods and fully investigate the weighted coupling of classes in different
cases in large-scale software systems, this study analyzed the relationship between classes at package level, class level, and method
level. Method. The software system is considered as a set of special bipartite graphs in complex networks, and an effective method
for coupling measurement is proposed as well. Furthermore, this method is theoretically proved to satisfy the mathematical
properties of coupling measurement, leading to overcome the disadvantages of the majority of existing methods. In addition, it
was revealed that the proposed method was efficient according to the analyses of existing methods for coupling measurement.
Eventually, an algorithm was designed and a program was developed to calculate coupling between classes in three open-source
software systems. Results. The results indicated the scale-free characteristic of complex networks in the statistical data. Addi-
tionally, the calculated power-law value was used as a metric for coupling measurement, so as to calculate coupling of the three
open-source software. It indicated that coupling degrees of the open-source software systems contained a certain impact on
evaluation of software complexity. Conclusions. It indicated that coupling degrees of the open-source software systems contained a
certain impact on evaluation of software complexity. Moreover, statistical characteristics of some complex networks provided a
reliable reference for further in-depth study of coupling. The empirical evidence showed that within a certain range, reducing the
coupling was helpful to attenuate the complexity of the software, while excessively blindly pursuit of low coupling increases the
complexity of software systems.
of the system. Therefore, it is expected that classes are loosely methods contain some limitations, which cannot
coupled in terms of software design. A system can be tightly properly satisfy the requirement of an effective
coupled in one aspect while being loosely coupled in an- coupling measurement in complex software systems.
other. However, software developers mainly prefer to de- (3) Although a number of coupling measurement
velop those systems that are as loosely coupled as possible; methods analyze network relationship from overall
thus, design, testing, and maintenance of the system would and macro perspectives based on graph theory, the
be relatively independent and more reasonable. Moreover, a majority of measurement metrics mainly use classes,
decrease may be observed in the possibility that errors packages, or methods as nodes to construct some
propagate between modules if there are few connections undirected, directed, unweighted, or weighted net-
between modules [4]. Coupling has been widely used in work models. Moreover, they ignore a complex re-
evaluation of the degree of failure in classification [5–7], lationship of object-oriented characteristics between
effective analysis [8, 9], and design pattern [10] of software different classes. Some methods have not been
systems. theoretically verified for developing the mathemat-
The present article has the following organization: ical characteristics of the measurement metrics.
Section 2 summarizes the materials and methods. Section 3
shows the results. Section 4 provides a conclusion and The process of establishment of an effective method for
suggests perspectives. coupling measurement between classes in a software sys-
tem is determined by the following two aspects: reasonable
measurement metrics and theoretical support of mea-
2. Materials and Methods surement metrics [24, 25]. Briand et al. mathematically
2.1. Methods. Currently, the methods for coupling mea- analyzed measurement metrics of the software system and
surement of object-oriented software systems are mainly presented a robust theoretical support for the measurement
structure-oriented measurement methods (Tables 1 and 2) metrics [4, 26, 27]. Many of complex networks have been
[8, 11–15]. shown to share the features such as “scale-free” and “small
Comparative analysis of typical methods is shown in world” [28, 29]. Pan et al. revealed many physics-like laws
Tables 1–3, indicating that in software systems from a complex network perspective
recently [30, 31]. Studies on complex networks and soft-
(1) Methods for coupling measurement are mainly ware engineering revealed that class-level, method-level,
based on method invocation between classes. and package-level diagrams of a software system could
(2) Calculation of coupling strength is defined as the show the characteristics of “scale-free” and “small world,”
degree of method invocation, which is weighted which provided a novel perspective for finding more
coupling. reasonable measurement metrics [32–34]. Complex net-
(3) A small number of methods use fan-in and fan-out as work theories were applied to measure software [35, 36],
metrics. identify key software elements [37], and cluster Web ser-
vices [38–39]. Researchers have found that many real
(4) Inheritance is dominant. networks have the bipartite graph characteristics of com-
(5) Few methods use static method invocation, system plex networks [40–45]. With combination of package level,
measurement, and package-level metrics. class level, and method level, this study analyzed a complex
In addition to the abovementioned structural informa- relationship between classes in the same layer and all layers
tion methods, some scholars have recently used dynamic of a package and proposed a method for coupling metrics
information methods [17, 18], semantic information for object-oriented systems based on bipartite graph of
methods [19–21], and logical information methods [22, 23]. complex networks, named here CSBG, and object-oriented
Based on the results of previous studies, methods of coupling software systems were expressed as a set of special bipartite
measurement cover the following cases: graphs.
direction. Aggregation implies that one class exists in an- subpackages. Software systems can actually be considered to
other class in the form of attribute. be a tree hierarchical structure composed of packages.
t layer of a package is defined as pt ≤ Et+1 , Rt+1 > . Et+1
represents a set of classes in the t layer, while this layer does
Definition 2. DEP relationship (dependency)
not contain subpackages of this layer. Rt+1 represents class
DEP_D: dynamic dependency refers to an instance method
relationship in the t layer, that is, Rt+1 ⊆ Et+1 × Et+1 .
in a class that invokes methods and attributes in another class.
S layer(i) is defined as a set of weighted fan-out of Ci at
DEP_S: static dependency refers to static methods in a
the t layer of the package, that is, S layer(i) ⊆ Rt+1 . S all(i) is
class invokes methods and attributes in another class.
the set of weighted cross-package fan-out of Ci , that is,
S all(i) ⊆ R1 ∪ R2 · · · Rt · · ·.
Definition 3. GEN (generalization)
One class inherits with another class, or one class imple-
ments interfaces with another class, or that of an abstract class. 2.3. CSBG for Coupling Measurement. Software stability and
modularity could be measured based on complex network
theories. In this study, software systems can be expressed as a
2.2.2. Definition of Package Hierarchy. Packages of an ob- set of bipartite graphs that use nodes as classes, and ASS as
ject-oriented software system include classes and sub- well as DEP are the edges constituted by attributes of the
packages in the current hierarchy, and these subpackages class with those of another class based on complex network
contain classes in the current hierarchy and their theories. However, GEN is a direct connection between
4
× x 1 , x2 , x3 , x4 T ,
n n n
Figure 1: Illustration of a software system network composed of a
S all(i) � ⎡
⎣ ASS all(i), DEP D all(i),
set of special bipartite graphs (the large squares represent packages,
and the 4 packages are at the same layer. The small squares show i�1 i�1 i�1
n n
subpackages in the package. The circles denote classes in the
package, and edges represent relationship between classes). DEP S all(i), GEN all(i)⎤⎦
i�1 i�1
–
S
1/n
∑S(i)
β, b
b4
b3+ 5 +b
b2+ 6 +b
α, b1+ 7 +b
8
∑S_layer(i) ∑S_all(i)
DEP D(i) � Ci , Cj Ojp′ Mjr′ , Ci , Cj Ojp′ Ajq′ number of weighted fan-out in a class. The third case is that
the number of weighted fan-out of a class is heterogeneity,
· 1 ≤ j ≤ N, 1 ≤ p′ ≤ p, 1 ≤ r′ ≤ r, which approximately obeys the power-law distribution. For
the second case, heterogeneity of the out-degree of the class
1 ≤ q′ ≤ q, Ci , Cj Ojp′ Mjr′ ∈ RDEP D ,
is superior than that of the first case; however, this is im-
Ci , Cj Ojp′ Ajq′ ∈ RDEP D A .
possible to be compared with the third case. For the third
case, because the number of fan-out is limited for the
(4)
majority of classes, only few classes have a large number of
fan-out; therefore, maintenance staff can dedicate more
Implementing connecting edges between two classes effort on these few classes. Moreover, the maintenance
through class methods and class variables. workload of these classes is lower than that of the first case.
If there are class methods of Cj (static methods) in class In this study, heterogeneity under the situation of fan-
Ci : Cj .Mjr′ , and 1 ≤ r′ ≤ r, then the relationship be- out was analyzed. If the distribution was the above-
tween classes Ci and Cj is defined as mentioned third case, then the larger the power-law value,
(Ci , Cj Mjr′ ) ∈ RDEP S M , 1 ≤ r′ ≤ r. If there are class the easier the maintenance, and the smaller the coupling
variables (static variables) of Cj in class degree. However, if the distribution was one of the other two
Ci :Cj .Ajq′ , 1 ≤ q′ ≤ q, then the relationship between cases, then it was considered in this study that the power-law
classes Ci and Cj is defined as value was equal to 1. b1 , b2 , b3 , and b4 are the power-law
(Ci , Cj Ajq′ ) ∈ RDEP S A , 1 ≤ q′ ≤ q. Thereafter, under values for the distribution of ASS layer, DEP D layer,
the conditions of class methods and class variables, the DEP S layer, and GEN layer, respectively. b5 , b6 , b7 , and b8
set of weighted out-degree for class Ci was are the power-law values for the distribution of ASS all,
DEP D all, DEP S all, and GEN all, respectively. The cal-
DEP S(i) � Ci , Cj Mjr′ , Ci , Cj Ajq′ culating formula for weights was as follows:
· 1 ≤ j ≤ N, 1 ≤ r′ ≤ r, 1 ≤ q′ ≤ q,
T
(5) T
4
bi 4 bi 4 bi 4 bi ⎤⎦
Ci , Cj Mjr′ ∈ RDEP S M, x1 , x2 , x3 , x4 � ⎡⎣ , , , ,
b b b b
i�1 1 i�1 2 i�1 3 i�1 4
Ci , Cj Ajq′ ∈ RDEP S A .
8 T
T b 8 b 8 b 8 b
GEN x5 , x6 , x7 , x8 � ⎡⎣ i , i , i , i ⎤⎦ ,
b b b b
i�5 5 i�5 6 i�5 7 i�5 8 (7)
As the inheritance is preferred in software engi-
neering, if one class is a subclass of another class, the 8i�4 bi
derived connecting edge was taken into account only α� ,
8i�1 bi
once in this study. Because transfer of derived con-
necting edges would make the software system net-
β � 1 − α.
work more complex, this study did not consider
transfer of derived connecting edge but only con- In the present study, statistical analyses were performed
sidered the conditions that class Ci was a direct for the out-degree of the three open-source software sys-
subclass of class Cj (through extension), or class Ci tems, and the distributions were the first and the third cases
was implemented through interface class Cj (through as mentioned above, demonstrating that the proposed
implementation), or class Ci was implemented by method had a certain practical value.
abstract class Cj (through extension). Thus, there was
a GEN connecting edge between classes Ci and Cj ,
which was defined as (Ci , Cj ) ∈ RGEN , and a set of 2.4. Theoretical Verification of Coupling Metrics. Whether the
GEN weighted out-degree for class Ci was proposed CSBG method met the mathematical properties of
the measurement metrics [4] was theoretically verified.
GEN(i) � Ci , Cj Ci , Cj ∈ RGEN . (6) CSBG Property 1. CSBG satisfies nonnegativity.
There were three classes in the package graph, including DEP_S, and GEN, were corresponded to the cases described
class Shape, class Point, and class Line. in Section 2.3. Out-degrees of classes in various layers are
There were three classes in the package graph.polygon, shown in Table 4.
which were classes of Triangle, Square, and Quadrilateral. The mathematical model described in Section 2.3 was
In this study, an algorithm was designed and the pro- herein used. Because the number of classes was small, the
gram was developed based on the aforementioned mathe- heterogeneity of out-degree of classes could not be reflected.
matical model, mainly calculating the four metrics for the Moreover, heterogeneity had little impact on the coupling in
out-degree of classes in the same layer and different layers of this example. Therefore, it was considered that heterogeneity
the package in software systems, including ASS, DEP_D, was approximately the same. Coupling of software systems
DEP_S, and GEN. Coupling metrics, including ASS, DEP_D, was calculated as follows:
10 Mathematical Problems in Engineering
6i CSBG Ci
CSBG(G) � � 6.55,
6
T
x1 , x2 , x3 , x4 � [1, 1, 1, 1]T ,
T
x5 , x6 , x7 , x8 � [1, 1, 1, 1]T ,
α � 0.5,
β � 1 − α � 0.5,
n n n n n
S layer(i) � ⎡⎣ ASS layer(i), DEP D layer(i), DEP S layer(i), GEN layer(i)⎤⎦ × x , x , x , x T
1 2 3 4
i�1 i�1 i�1 i�1 i�1
� 19,
(10)
n n n n n
S all(i) � ⎡⎣ ASS all(i), DEP D all(i), DEP S all(i), GEN all(i)⎤⎦ × x , x , x , x T
5 6 7 8
i�1 i�1 i�1 i�1 i�1
� 67,
n n n
S � S(i) � ⎡⎣ S layer(i), S all(i)⎤⎦ ×[α, β]T
i�1 i�1 i�1
� 43,
S 43
S� � � 7.17.
n 6
Mathematical Problems in Engineering 11
Table 4: Out-degrees of classes at the same layer and all layers of the package.
Out-degree at the same layer Out-degree of all layers
Class name
ASS DEP_D DEP_S GEN Total ASS DEP_D DEP_S GEN Total
Quadrilateral 0 0 0 0 0 8 16 0 1 25
Triangle 0 0 0 0 0 6 12 0 1 19
Line 6 10 0 1 17 6 10 0 1 17
Point 0 0 0 1 1 0 0 0 1 1
Shape 0 0 0 0 0 0 0 0 0 0
Square 0 0 0 1 1 4 0 0 1 5
Total 6 10 0 3 19 24 38 0 5 67
2.5.2. Analysis of the Results of Various Methods for Coupling and (4) the source codes were available as well. Scholars can
Measurement. Coupling of software systems was calculated freely download the source codes from an open-source
based on existing measurement methods, which is shown in website (http://sourceforge.net).
Table 5. In addition to CSBG coupling measurement, other
measurement methods mainly focus on measurement of a
certain local fine-grained aspect. These methods were based on 3.2. Association of Coupling with Statistical Characteristics of
the theory of reductionism, which did not investigate the the Three Open-Source Software Systems. Firstly, the pro-
coupling of software systems from an overall and global gram was developed and out-degree of classes at the same
perspective. Therefore, the measurement values were mostly layer and all layers of the package was eventually obtained,
either very large or very small, and several metrics were equal to including ASS, DEP_D, DEP_S, and GEN.
0. In addition, discrimination of these metrics was not sig- In this section, DEP_D and DEP_S were analyzed, and
nificant compared with other methods for coupling mea- the results are shown in Figures 11–18. In the experimental
surement. The metrics calculated by CSBG had a better results, DEP(i) was a nonstandardized part of probability
discrimination. Therefore, the existed methods have limita- distribution P(i). If, P(i) ∼ i− c , then DEP ∼ (i)− c . A linear
tions, which cannot accordingly satisfy an effective coupling function was fitted using the double logarithmic method that
measurement for complex software systems. CSBG not only was fitted to estimate Gamma index c (R is the Pearson’s
can consider a complex relationship between classes in object- correlation coefficient and SD is standard deviation; c is also
oriented software systems but also analyze the complexity of expressed as B in the following table).
classes and the special bipartite graph composed of classes from Although inheritance between classes increases coupling of
the prospective of overall package level. Therefore, the CSBG the system, this is encouraged by the software system, which is
measurement method contained a certain rationality in theory. conducive to reduce function definition and attribute defini-
tion in order to create a new class; thus, it is a poor coupling. It
3. Results can be seen from linear distribution of GEN (Table 6) that
neither all classes have an inheritance relationship, nor the
3.1. Application of CSBG Measurement Metrics in the Three GEN fan-out of all classes were very large or very small.
Open-Source Software Systems. In order to further validate However, classes with values equal to 0 or 1 were dominant.
the effects of CSBG, this study used CSBG to measure and Pearson’s correlation coefficient (R) and SD value pro-
analyze coupling between classes in the three Java open- vided the quality of the linear fitting; the larger the R value,
source software systems from different fields, including Art the better the quality of the linear fitting, and B is estimated
of Illusion [48], JabRef [49], and GanttProject [50]. Some Gamma index c. Moreover, the smaller the SD value, the
studies have reported results of class cohesion metrics for the better the quality of the linear fitting. As shown in Table 7, if
three open-source software systems [51–53]; it is feasible to 0.95 is considered to be the minimum value, it can be ap-
further study the complexity of the three open-source proximated that the distribution obeyed the power-law
software systems if there is a more reasonable method for distribution except that ASS value in JabRef was relatively
coupling measurement. In order to verify the effects of the small (0.91651 and 0.88148). Furthermore, the distributions
CSBG measurement method in actual open-source software of ASS layer, ASS_all layer, DEP_D layer, DEP_S layer,
systems, three Java open-source software systems from DEP_D_all layer, and DEP_S_all layer were assumed to obey
different aforementioned fields were used. Art of Illusion is a power-law distribution. The results demonstrated that there
software system for 3D rendering, modeling, and animation. was a certain rule for the number of fan-out of classes in the
JabRef is a graphical application for managing bibliographic form of ASS and DEP, which was not the case that the values
database. GanttProject is a software system for project were mostly large or small. However, they had “scale-free”
scheduling characterized by resource calendar, manage- property for complex networks, which obeyed the power-
ment, and import or export (MS Project, PDF, HTML). The law distribution. In actual software development process, if
reasons to use the three open-source software systems in the software developers excessively pursue low coupling be-
measurement were because (1) these systems were based on tween classes, a class may be divided into two or more
object-oriented Java; (2) the classes in the systems had a subclasses; thus, system complexity may be accordingly in-
certain scale; (3) the three systems were from different fields; creased. The process of determination of the range of coupling
12 Mathematical Problems in Engineering
R = 0.94567
log10 (ASS_layer(i))
R = 0.91651
log10 (ASS_layer(i))
10 SD = 0.08465
SD = 0.17962 SD = 0.11961
1 < i < 471 10
0 < i < 695 0 < i < 947
1
1
1
0.1
0.1
0.1 10 100 1000
1 10 100 1 10 100
log10 (i) log10 (i)
log10 (i)
(a) (b) (c)
Figure 11: The double logarithmic diagrams of the fan-out of ASS invocation for classes at the same layer of a package.
log10 (DEP_D_layer(i))
100 R = 0.97537
log10 (DEP_D_layer(i))
1
1
1
Figure 12: The double logarithmic diagrams of the fan-out of DEP_D invocation for classes at the same layer of a package.
Mathematical Problems in Engineering 13
log10 (DEP_S_layer(i))
log10 (DEP_S_layer(i))
log10 (DEP_S_layer(i))
1 0.1
0.1
1 10 100 1 10 100 10 100 1000
log10 (i) log10 (i) log10 (i)
Figure 13: The double logarithmic diagrams of the fan-out of DEP_S invocation for classes at the same layer of a package.
3.0 4 3.0
2.5 2.5
3
GEN_layer(i)
GEN_layer(i)
GEN_layer(i)
2.0 2.0
1.5 2 1.5
1.0 1.0
1
0.5 0.5
0.0 0 0.0
0 100 200 300 400 500 –100 0 100 200 300 400 500 600 700 0 200 400 600 800 1000
i i i
(a) (b) (c)
Figure 14: The double logarithmic diagrams of fan-out of GEN invocation for classes at the same layer of a package.
log10 (ASS_all(i))
1
1 1
0.1
1 10 100 1 10 100 10 100 1000
log10 (i) log10 (i) log10 (i)
Figure 15: The double logarithmic diagrams of the fan-out of ASS invocation for classes at all layers of a package.
R = 0.97028 R = 0.96602
log10 (DEP_D_all(i))
log10 (DEP_D_all(i))
Figure 16: The double logarithmic graph of fan-out of DEP_D invocation for classes at all layers of a package.
14 Mathematical Problems in Engineering
log10 (DEP_S_all(i))
log10 (DEP_S_all(i))
log10 (DEP_S_all(i))
R = 0.97265 R = 0.96831 R = 0.95419
SD = 0.1208 SD = 0.14207 10 SD = 0.12876
10 0 < c < 471 0 < i < 695 0 < c < 947
10
1
1
1
0.1
1 10 100 1 10 100 10 100 1000
log10 (i) log10 (i) log10 (i)
Figure 17: The double logarithmic diagrams of fan-out of DEP_S invocation for classes at all layers of a package.
4 4 5
4
3 3
GEN_all(i)
GEN_all(i)
GEN_all(i)
3
2 2
2
1 1
1
0 0 0
0 100 200 300 400 500 –100 0 100 200 300 400 500 600 700 0 200 400 600 800 1000
i i i
(a) (b) (c)
Figure 18: The double logarithmic diagrams of fan-out of GEN invocation for classes at all layers of a package.
between classes in software systems is significant. Based on 0, 1, and 2 for class inheritance in generalization, interface
data analysis, it can be seen that scale-free” property of implementation, and implementation of abstract classes, which
complex networks motivated software developers to pay more were approximately linearly distributed. Therefore, the power-
attention to the distribution range of the coupling in large- law value of GEN was approximated to 1.
scale software systems, which could provide a reliable ref-
erence for developing more reasonable software systems.
3.3.1. Calculation of Coupling Measurement for Art of
Illusion. According to the CSBG method for coupling
3.3. Coupling Measurement for the Three Open-Source Soft-
measurement, coupling of the software system for Art of
ware Systems. According to the results of the above-
Illusion was calculated as follows:
mentioned analysis, out-degrees of classes were often equal to
4 T
T bi 4 bi 4 bi 4 bi ⎤⎦
x1 , x2 , x3 , x4 � ⎡⎣ , , ,
b b b b
i�1 1 i�1 2 i�1 3 i�1 4
4 4 4 4 T
bi bi bi b
� ⎡⎣ , , , i ⎤⎦
i�1
2.51614 i�1
6.07342 i�1
5.52632 i�1
1
8 T
T bi 8 bi 8 bi 8 bi ⎤⎦
x5 , x6 , x7 , x8 � ⎡⎣ , , ,
b b b b
i�5 5 i�5 6 i�5 7 i�5 8
8 8 8 8 T
bi bi bi b
� ⎡⎣ , , , i ⎤⎦
i�5
1.84955 i�5
3.39056 i�5
3.5066 i�5
1
8i�4 bi
α� � 0.392023,
8i�1 bi
β � 1 − α � 0.607977,
n n n n n (11)
S layer(i) � ⎡⎣ ASS layer(i), DEP D layer(i), DEP S layer(i), GEN layer(i)⎤⎦ × x , x , x , x T
1 2 3 4
i�1 i�1 i�1 i�1 i�1
� 38861.91,
n n n n n
S all(i) � ⎡⎣ ASS all(i), DEP D all(i)(i), DEP S all(i), GEN all(i)⎤⎦ × x , x , x , x T
5 6 7 8
i�1 i�1 i�1 i�1 i�1
� 96264.25,
n n n
S � S(i) � ⎡⎣ S layer(i), S all(i)⎤⎦ ×[α, β]T
i�1 i�1 i�1
� 73761.21,
S 73761.21
S� � � 156.9387.
n 470
16 Mathematical Problems in Engineering
4 4 4 4 T
T ⎣ bi bi , bi , bi , bi ⎤⎦
x1 , x 2 , x 3 , x 4 � ⎡
b b b b
i�1 1 1 i�1 2 i�1 3 i�1 4
b
4 4 4 4 T
⎣ bi bi bi bi b
�⎡ , , , i ⎤⎦
i�1
7.1483 7.1483 i�1 20.06268 i�1 14.97997 i�1 1
8 8 8 8 T
T ⎣ bi , bi , bi , bi ⎤⎦
x5 , x 6 , x 7 , x 8 � ⎡
b b b b
i�5 5 i�5 6 i�5 7 i�5 8
8 8 8 8 T
bi bi bi b
�⎣
⎡ , , , i ⎦⎤
i�5
1.65033 i�5 8.47787 i�5 4.47638 i�5 1
8i�4 bi
α� � 0.26540419,
8i�1 bi
β � 1 − α � 0.734596,
n n n n n (12)
S layer(i) � ⎡ T
⎣ ASS layer(i), DEP D layer(i), DEP S all(i), GEN layer(i)⎤⎦ × x1 , x2 , x3 , x4
i�1 i�1 i�1 i�1 i�1
� 29375.8,
n n n n n
S all(i) � ⎡
⎣ ASS all(i), DEP D all(i), DEP S all(i), GEN all(i)⎤⎦ × x , x , x , x T
5 6 7 8
i�1 i�1 i�1 i�1 i�1
� 71947.46,
n n n
⎣ S layer(i), S all(i)⎤⎦ ×[α, β]T
S � S(i) � ⎡
i�1 i�1
i�1
� 60648.76,
S 60648.76
S� � � 87.39015.
n 694
Mathematical Problems in Engineering 17
4 4 4 4 T
T ⎣ bi , bi , bi , bi ⎤⎦
x1 , x2 , x3 , x4 � ⎡
b b b b
i�1 1 i�1 2 i�1 3 i�1 4
4 4 4 4 T
⎣ bi bi bi b
�⎡ , , , i ⎤⎦
i�1
7.22368 i�1
25.12239 i�1
17.20075 i�1
1
8 T
T ⎣ bi 8 bi 8 bi 8 bi ⎤⎦
x5 , x 6 , x 7 , x 8 � ⎡ , , ,
b b b b
i�5 5 i�5 6 i�5 7 i�5 8
8 8 8 8 T
bi bi bi b
�⎣
⎡ , , , i ⎦⎤
i�5
3.64204 i�5 9.56684 i�5 5.99337 i�5 1
8i�4 bi
α� � 0.285548,
8i�1 bi
β � 1 − α � 0.714452,
n n n n n (13)
S layer(i) � ⎡
⎣ ASS layer(i), DEP D layer(i), DEP S layer(i), GEN layer(i)⎤⎦ × x , x , x , x T
1 2 3 4
i�1 i�1 i�1 i�1 i�1
� 31206.69,
n n n n n
S all(i) � ⎡
⎣ ASS all(i), DEP D all(i), DEP S all(i), GEN all(i)⎤⎦ × x , x , x , x T
5 6 7 8
i�1 i�1 i�1 i�1 i�1
� 46138.17,
n n n
S � S(i) � S layer(i), S all(i)⎤⎦ ×[α, β]T
⎣
⎡
i�1 i�1 i�1
� 41874.52,
S 41874.52
S� � � 44.26482.
n 946
18 Mathematical Problems in Engineering
The three aforementioned open-source software systems software systems using statistics of complex networks. In
were analyzed from the points of view of package level, class [54], it was mentioned that cohesion distribution of the
level, and method level using CSBG for coupling mea- majority classes of a software system contained a certain
surement. A program was also developed to calculate various regularity. In other words, it was not the case that neither
metrics; thus, the coupling of the three open-source software cohesion of all classes was very large nor very small. In the
systems in descending order was the Art of Illusion, JabRef, empirical analysis of coupling, the values of coupling metrics
and GanttProject, suggesting that it was feasible to use CSBG had a regularity similar to class cohesion. Although coupling
for coupling measurement of software systems that con- represented the degree of interdependence between classes,
tained a certain practical value. the greater the coupling, the more complex the software
from an intuitive aspect. However, excessive pursuit of “high
4. Conclusion cohesion and low coupling” of software systems increases
the workload of software developers and the complexity of
Based on bipartite graphs for complex networks, by com- software systems as well. Therefore, the empirical evidence
prehensive consideration of the weighted fan-out between showed that within a certain range, reducing the coupling
classes from points of view of package level, class level, and was helpful to attenuate the complexity of the software, while
method level, this study expressed that the interaction of excessively blindly pursuit of low coupling increases the
classes is a special bipartite graph, while a software system is complexity of software systems.
a set of these special bipartite graphs. For this purpose, first,
this study analyzed the four relationships for a software Data Availability
system, including ASS, DEP_D, DEP_S, and GEN, and
coupling relationship for a class with other classes in the The data used to support the findings of this study are
same layer of package was considered as well. Moreover, available from the corresponding author upon request.
coupling relationship for classes in a package with other
classes in different layers of the package was taken into Conflicts of Interest
account. Therefore, the CSBG method for coupling mea-
surement of software systems was proposed, which was The authors declare that there are no conflicts of interest
completely in compliance with the mathematical charac- regarding the publication of this paper.
teristics of the widely accepted metrics. Second, for a soft-
ware system, other typical methods and CSBG method were Acknowledgments
compared for the purpose of coupling measurement, and the This work was supported by the National Natural Science
results revealed that the measured value was either large or Foundation of China (no. 61602400). This work was also
small due to the defects of other measurement methods that supported in part by the Key Research and Development
were analyzed from an overall and global perspective. Program of Hangzhou under Grant 20182011A46.
Moreover, the corresponding values were mostly equal to 0.
Therefore, there were some defects in other measurement
References
methods, while CSBG had its rationality. Eventually, a
program was developed based on the CSBG method to apply [1] W. P. Stevens, G. J. Myers, and L. L. Constantine, “Structured
the three open-source software systems (Art of Illusion, design,” IBM Systems Journal, vol. 13, no. 2, pp. 115–139, 1974.
JabRef, and GanttProject). The results demonstrated that [2] W. P. Stevens, G. J. Myers, and L. L. Constantine, “Structured
coupling of the three open-source software systems in the design,” IBM Systems Journal, vol. 38, no. 2, pp. 231–256, 1999.
descending order was the Art of Illusion, JabRef, and [3] E. Yourdon and L. L. Constantine, Structured Design: Fun-
GanttProject. Although inheritance between classes in- damentals of a Discipline of Computer Program and Systems
Design, Yourdon Press, Englewood Cliffs, NJ, USA, 1979.
creases coupling of the system, this is also followed by
[4] L. C. Briand, J. W. Daly, and J. K. Wust, “A unified framework
software engineering, which is conducive to reduce function for coupling measurement in object-oriented systems,” IEEE
definition and attribute definition in order to create a new Transactions on Software Engineering, vol. 25, no. 1, pp. 91–
class, and thus, this is weak coupling. It can be concluded 121, 1999.
from the linear distribution of GEN that all classes either had [5] M. D’Ambros, M. Lanza, and R. Robbes, “On the relationship
an inheritance relationship, or that the number of GEN fan- between change coupling and software defects,” in Proceed-
out of all classes was very large or very small. However, ings of the 2009 16th Working Conference on Reverse
classes with values equal to 0 or 1 were accounted. Fur- Engineering, Lille, France, October 2009.
thermore, it was revealed that in the same layer and total [6] T. Gyimothy, R. Ferenc, and I. Siket, “Empirical validation of
layers of the package, fan-out values of ASS, DEP_D, and object-oriented metrics on open source software for fault
DEP_S obeyed the scale-free property of complex networks. prediction,” IEEE Transactions on Software Engineering,
vol. 31, no. 10, pp. 897–910, 2005.
These findings provided empirical support for the CSBG
[7] P. Yu, T. Systa, and H. Muller, “Predicting fault-proneness
method. The statistical power-law metrics were applied to using OO metrics. An industrial case study,” in Proceedings of
the method for coupling measurement proposed in this the Sixth European Conference on Software Maintenance and
study in order to calculate the coupling of the three open- Reengineering, Budapest, Hungary, March 2002.
source software systems, which provided a reliable reference [8] L. C. Briand, J. Wuest, and H. Lounis, “Using coupling
for further investigation of coupling between classes in measurement for impact analysis in object-oriented systems,”
Mathematical Problems in Engineering 19
in Proceedings of the IEEE International Conference on Soft- [26] L. C. Briand, S. Morasca, and V. R. Basili, “Property-based
ware Maintenance, Oxford, UK, September 1999. software engineering measurement,” IEEE Transactions on
[9] F. G. Wilkie and B. A. Kitchenham, “Coupling measures and Software Engineering, vol. 22, no. 1, pp. 68–86, 1996.
change ripples in C++ application software,” Journal of [27] L. C. Briand, J. W. Daly, and J. Wüst, “A unified framework
Systems & Software, vol. 52, no. 2-3, pp. 157–164, 2000. for cohesion measurement in object-oriented systems,” Em-
[10] G. Antoniol, R. Fiutem, and L. Cristoforetti, “Using metrics to pirical Software Engineering, vol. 3, no. 1, pp. 65–117, 1998.
identify design patterns in object-oriented software,” in [28] D. J. Watts and S. H. Strogatz, “Collective dynamics of “small-
Proceedings of the Fifth International Software Metrics world” networks,” Nature, vol. 393, 1998.
Symposium, Bethesda, MD, USA, November 1998. [29] A.-L. Barabási and R. Albert, “Emergence of scaling in ran-
[11] S. R. Chidamber and C. F. Kemerer, “A metrics suite for object dom networks,” Science, vol. 286, no. 5439, pp. 509–512, 1999.
oriented design,” IEEE Transactions on Software Engineering, [30] W. Pan, H. Ming, C. K. Chang, Z. Yang, and D.-K. Kim,
vol. 20, no. 6, pp. 476–493, 1994. “ElementRank: ranking java software classes and packages
[12] S. R. Chidamber and C. F. Kemerer, “Towards a metrics suite using multilayer complex network-based approach,” IEEE
for object oriented design,” in Proceedings of the ACM Transactions on Software Engineering, 2019.
Conference on Object Oriented Programming, Systems, Lan- [31] W. Pan, B. Li, J. Liu, Y. Ma, and B. Hu, “Analyzing the
guages and Applications, Orlando, FL, USA, 1991. structure of java software systems by weighted K-core de-
[13] W. Li and S. Henry, “Object-oriented metrics that predict composition,” Future Generation Computer Systems, vol. 83,
maintainability,” Journal of Systems and Software, vol. 23, pp. 431–444, 2018.
no. 2, pp. 111–122, 1993. [32] C. R. Myers, “Software systems as complex networks:
[14] Y. Lee, “Measuring the coupling and cohesion of an object- structure, function, and evolvability of software collaboration
oriented program based on information flow,” in Proceedings graphs,” Physical Review E, vol. 68, no. 4, 15 pages, 2003.
of the International Conference on Software Qualiy, Maribor, [33] N. LaBelle and E. Wallingford, “Inter package dependency
Slovenia, 1995. networks in open source software,” 2004, http://arxiv.org/abs/
[15] L. Briand, P. Devanbu, and W. Melo, “An investigation into 0411096.
coupling measures for C++ software engineering,” in Pro- [34] D. Hyland-Wood, D. Carrington, and S. Kaplan, “Scale-free
ceedings of the 19th International Conference on Software nature of java software package,” class and method collabo-
ration graphs,” Techical report no. TR-MS1286, University of
engineering, Boston, MA, USA, May 1997.
[16] H. Li and B. Li, “A pair of coupling metrics for software Maryland College, College Park, MD, USA, 2006.
[35] Y. Xiang, W. Pan, H. Jiang, Y. Zhu, and H. Li, “Measuring
networks,” Journal of Systems Science and Complexity, vol. 24,
software modularity based on software networks,” Entropy,
no. 1, pp. 51–60, 2011.
vol. 21, no. 4, p. 344, 2019.
[17] E. Arisholm, L. C. Briand, and A. Foyen, Dynamic Coupling
[36] W. Pan and C. Chai, “Measuring software stability based on
Measurement for Object-Oriented Software, IEEE Press, Pis-
complex networks in software,” Cluster Computing, vol. 22,
cataway, NJ, USA, 2004.
no. S2, pp. 2589–2598, 2019.
[18] J. K. Chhabra and V. Gupta, “A survey of dynamic software
[37] W. Pan, B. Song, K. Li, and K. Zhang, “Identifying key classes
metrics,” Journal of Computer Science & Technology, vol. 25,
in object-oriented software using generalizedk-core decom-
no. 5, pp. 1016–1029, 2010.
position,” Future Generation Computer Systems, vol. 81,
[19] D. Poshyvanyk and A. Marcus, “The conceptual coupling
pp. 188–202, 2018.
metrics for object-oriented systems,” in Proceedings of the [38] W. Pan and C. Chai, “Structure-aware mashup service
2006 22nd IEEE International Conference on Software clustering for cloud-based internet of things using genetic
Maintenance, Philadelphia, PA; USA, September 2006. algorithm based clustering algorithm,” Future Generation
[20] D. Poshyvanyk, A. Marcus, R. Ferenc, and T. Gyimóthy, Computer Systems, vol. 87, pp. 267–277, 2018.
“Using information retrieval based coupling measures for [39] W. Pan, J. Dong, K. Liu, and J. Wang, “Topology and topic-
impact analysis,” Empirical Software Engineering, vol. 14, aware service clustering,” International Journal of Web Ser-
no. 1, pp. 5–32, 2009. vices Research, vol. 15, no. 3, pp. 18–37, 2018.
[21] M. Gethers and D. Poshyvanyk, “Using relational topic [40] F. Liljeros, C. R. Edling, L. A. N. Amaral, H. E. Stanley, and
models to capture coupling among classes in object-oriented Y. Åberg, “The web of human sexual contacts,” Nature,
software systems,” in Proceedings of the 2010 IEEE Interna- vol. 411, no. 6840, pp. 907-908, 2001.
tional Conference on Software Maintenance, Timisoara, [41] H. Jeong, B. Tombor, R. Albert, Z. N. Oltvai, and
Romania, September 2010. A.-L. Barabási, “The large-scale organization of metabolic
[22] H. Gall, K. Hajek, and M. Jazayeri, “Detection of logical networks,” Nature, vol. 407, no. 6804, pp. 651–654, 2002.
coupling based on product release history,” in Proceedings of [42] P.-P. Zhang, K. Kan Chen, Y. He et al., “Model and empirical
the International Conference on Software Maintenance, study on some collaboration networks,” Physica A: Statistical
Washington, DC, USA, April 1998. Mechanics and Its Applications, vol. 360, no. 2, pp. 599–616,
[23] T. Zimmermann, A. Zeller, P. Weissgerber, and S. Diehl, 2006.
“Mining version histories to guide software changes,” IEEE [43] Q. Xuan, F. Du, and T. J. Wu, “Empirical analysis of internet
Transactions on Software Engineering, vol. 31, no. 6, telephone network : from user ID to phone,” Chaos: An In-
pp. 429–445, 2005. terdisciplinary Journal of Nonlinear Science, vol. 19, no. 2,
[24] E. J. Weyuker, “Evaluating software complexity measures,” Article ID 023101, 2009.
IEEE Transactions on Software Engineering, vol. 14, no. 9, [44] M.-S. Shang, L. Lü, Y.-C. Zhang, and T. Zhou, “Empirical
pp. 1357–1365, 1988. analysis of web-based user-object bipartite networks,” EPL
[25] I. Vessey and R. Weber, “Research on structured program- (Europhysics Letters), vol. 90, no. 4, p. 48006, 2010.
ming: an empiricist’s evaluation,” IEEE Transactions on [45] K.-I. Goh, M. E. Cusick, D. Valle, B. Childs, M. Vidal, and
Software Engineering, vol. SE-10, no. 4, pp. 397–407, 2009. A.-L. Barabasi, “The human disease network,” Proceedings of
20 Mathematical Problems in Engineering