Docstoc

Establishing Relationships among Chidamber And Kemerer’s Suite of Metrics using Field Experiments

Document Sample
Establishing Relationships among Chidamber And Kemerer’s Suite of Metrics using Field Experiments Powered By Docstoc
					                                                         (IJCSIS) International Journal of Computer Science and Information Security,
                                                                                                             Vol. 9, No. 6, June 2011

  Establishing Relationships Among Chidamber and
  Kemerer’s suite of Metrics Using Field Experiments

                   Ezekiel U. Okike                                                    Adenike O. Osofisan
            Department of computer Science                                        Department of computer Science
                 University of Ibadan                                                   University of Ibadan
                   Ibadan, Nigeria                                                        Ibadan, Nigeria
                euokike@gmmail.com                                                  ao.osofisan@mail.ui.edu.ng


Abstract— Chidamber and Kemerer suite of metrics were                relationship between cohesion and coupling, inheritance
used in the study of 3250 classes from five JAVA based               and coupling (CBO), coupling and size
industrial systems. System 1 had 34 classes, System 2 had
318 classes, System 3 383 classes, System 4 1055 classes,               Keywords-software     measurement;     cohesion,         coupling,
and System 5 1460 classes. Metric values were computed               inheritance, Chidamber and Kemerer metrics
for the Lack of Cohesion in Methods (LCOM), Coupling
between Object Classes (CBO), Response For a Class                                         I.    INTRODUCTION
(RFC), Number of Children (NOC), Depth of Inheritance                Chidamber and Kemerer [3,4] defined a basic set of object-
(DIT), Weighted Methods per Class (WMC), Number of                   oriented measures which seem to be widely accepted [11]. The
Public Methods (NPM) and Afferent Coupling (CA).                     suite of metrics include the Lack of Cohesion in Methods
LCOM was used as cohesion variable; CBO, RFC, CA as                  (LCOM), Coupling between Object Classes (CBO), Response
coupling variables; WMC, NPM, NOC as size variables                  For a Class (RFC), Number of Children (NOC), Depth of
and DIT as inheritance variable. Descriptive statistics and          Inheritance (DIT), and Weighted Methods per Class (WMC).
correlation analysis were used to analyze the results. Tests         The Lack of Cohesion in Methods (LCOM) metric measures
of hypotheses were carried out to examine if there were              the dissimilarity of methods in a class by instance variables or
significant relationships between cohesion and coupling              attributes. A highly cohesive module should stand alone; high
variables, cohesion and size variables, cohesion and                 cohesion is an indication of good class subdivision. Lack of
inheritance variables, coupling and inheritance variables,           cohesion or low cohesion increases complexity, thereby
coupling and size variables, inheritance and size variables.         increasing the likelihood of errors during the development
The results of the study showed that in System 1, there              process. It is suggested that classes with low cohesion could
were strong significant relationships between cohesion and           be divided into two or more subclasses with increased
coupling (CBO, RFC), cohesion and size (WMC,NPM),                    cohesion [4]. A critical evaluation of this is already presented
coupling and size variables (WMC, NPM), and a weak                   in [7]
relationship between Affarent coupling CA and
inheritance (DIT). In System 2, there were strong                    Coupling between Objects (CBO) is a count of the number of
significant relationship between cohesion and coupling               other classes to which a class is coupled. It is measured by
(CBO, RFC), cohesion and size variables (WMC, NPM),                  counting the number of distinct non-inheritance related class
coupling and size (WMC, NPM); a low relationship                     hierarchies on which a class depends. Excessive coupling is
between coupling by CA and WMC, NOC, and a weak                      detrimental to modular design and prevents reuse. The more
relationship between inheritance DIT and WMC, RFC,                   independent a class is, the easier it is reused in another
NPM. In System 3, there were strong significant                      application. Hence, the larger the number of couples, the
relationship between cohesion and coupling (CBO, RFC),               higher the sensitivity to changes in other parts of the design
cohesion and size (WMC, NPM), coupling and size (WMC,                and therefore maintenance is more difficult. Strong coupling
NPM); a low relationship between coupling by CA. In                  complicates a system since a class is hard to understand,
System 4, there were strong significant relationship                 change or correct by itself if it is interrelated with other
between cohesion and coupling (RFC), cohesion and size               classes. Complexity can be reduced by designing systems with
(WMC, NPM), size WMC and Size NPM. There were low                    the weakest possible coupling between classes. This improves
relationships between cohesion and coupling (CBO, CA)                modularity and promotes encapsulation [1,2,5].
and weak relationships between inheritance DIT and CA,
inheritance and size (WMC). In System 5, there were                  Response for a Class (RFC) is a count of the set of all
strong significant relationship between cohesion and size            methods that can be invoked in response to a message to an
(WMC, NPM), coupling and size (WMC, NPM); a low                      object of the class or by some method in the class. This



                                                               175                              http://sites.google.com/site/ijcsis/
                                                                                                ISSN 1947-5500
                                                             (IJCSIS) International Journal of Computer Science and Information Security,
                                                                                                                 Vol. 9, No. 6, June 2011
include all methods assessable within the class hierarchy. RFC                Specifically, the research questions investigated by this
metric combines the complexity of a class through the number              study are the following:
of methods and the amount of communication with other                         • Is there any significant relationship between cohesion
classes. The larger the number of methods that can be invoked                     variables and coupling variables?
from a class through messages, the greater the complexity of
                                                                               •     Is there any significant relationship between cohesion
the class. If a large number of methods can be invoked in
                                                                                     and the size of a class?
response to a message, the testing and debugging of the class
becomes complicated since a greater level of understanding on                  •     Is there any significant relationship between cohesion
the part of the tester is required. A worst case value for                           and the level of inheritance in a class?
possible responses will assist in the appropriate allocation of
                                                                               •     Is there any significant relationship between coupling
testing time .
                                                                                     variables and the size of a class?
                                                                               •     Is there any significant relationship between coupling
Number of Children (NOC) is the number of immediate                                  variables and inheritance?
subclasses subordinate to a class in the hierarchy. It is an
indicator of the potential influence a class can have on the                   •     Is it true that the larger the number of methods, the
design and on the system. The greater the number of children,                        lower the cohesiveness, and the higher the coupling of
the greater the likelihood of improper abstraction of the parent                     the class?
and may be a case of misuse of sub classing. But the greater
the number of children, the greater the reuse since inheritance           C.    Statemment of Research Hypotheses
is a form of reuse. If a class has a large number of children, it              • H0: There is no significant relationship between class
may require more testing of methods of that class, thus                           cohesion and coupling.
increases the testing time.
                                                                                     H1: There is significant relationship between class
Depth of Inheritance Tree (DIT) of a class within the                                cohesion and coupling.
inheritance hierarchy is the maximum number of steps from
the class node to the root of the tree and is measured by the                  •     H0: There is no significant relationship between class
number of ancestor classes. The deeper a class is within the                         cohesion and the size of a class
hierarchy, the greater the number of methods it is likely to                         H1: There is significant relationship between class
inherit making it more complex to predict its behavior.                              cohesion and the size of a class.
Deeper trees constitute greater design complexity, since more
methods and classes are involved, but the greater the potential                •     H0: There is no significant relationship between class
                                                                                     cohesion and inheritance.
for reuse of inherited methods. A support metric for DIT is the
number of methods inherited .                                                        H1: There is significant relationship between class
Weighted Method Per Class (WMC) is a count of the methods                            cohesion and inheritance.
implemented within a class or the sum of the complexities of
                                                                               •     H0: There is no significant relationship between
the methods (method complexity being measured by                                     coupling and inheritance.
cyclomatic complexity). It is difficult to implement WMC by
the cyclomatic complexity method because not all methods are                         H1: There is significant relationship between coupling
assessable within the class hierarchy due to inheritance. The                        and inheritance.
number of methods and the complexity of the methods
involved is a predictor of how much time and effort is required           D.       Methodology
to develop and maintain the class. The larger the number of                         Chidamber and Kemerer’s Lack of Cohesion in Methods
methods in a class, the greater the potential impact on                             (LCOM) metric was experimentally examined using a
children; children inherit all methods defined in the parent                        metric tool that computes Chidamber and Kemerer
class. Classes with large number of methods are likely to be                        metric (ckjm), and a Java based Scanning program. The
more application specific, limiting the possibility of                              Chidamber and Kemerer metric tool and the Java based
reuse[1,2,5] .                                                                      scanning program were applied in the experimental
                                                                                    study of 3250 classes from five Java based industrial
A.     Aims and Objectives                                                          systems in order to measure class cohesion, coupling,
                                                                                    and inheritance in the selected systems. The choice of
    The overall aims and objectives of this study were to                           Chidamber and Kemerer metric as the base metric for
investigate the relationship among Chidamber and Kemerer                            this study was informed by the fact that the components
suite of metrics : LCOM, CBO, RFC, NOC, DIT, WMC and                                of the metric enabled the measurement of all variables
their implication in software design and implementation.                            needed in this study such as Lack of Cohesion in
                                                                                    Methods (LCOM), Coupling Between Object classes
B.     Research Questions                                                           (CBO), Weighted Methods per Class (WMC), Depth of
                                                                                    Inheritance Tree (DIT), Number of Children (NOC),
     Identify applicable sponsor/s here. (sponsors)



                                                                    176                                http://sites.google.com/site/ijcsis/
                                                                                                       ISSN 1947-5500
                                                   (IJCSIS) International Journal of Computer Science and Information Security,
                                                                                                       Vol. 9, No. 6, June 2011
and Response For a Class (RFC). Two other metrics,                 Table 1.1. Some characteristics of the selected test
although not part of Chidamber and Kemerer were used
                                                                   systems
namely: Number of Public methods (NPM), and
Afferent Coupling (CA). The decision to incorporate                             Sys1 Sys2        Sys3       Sys4       Sys5     Total
the use of NPM and CA metrics in this study was
informed by the need to have a measure of the number
of public methods as well as a measure of afferent                 No of         34    318       383       1055       1460      3254
coupling in the systems. Moreover the metric tool used
                                                                   classes
to compute the Chidamber and Kemerer metrics already
incorporated NPM and CA measures. Cohesion is                      No of         30    3388      685       22000      223066    249179
measured by LCOM; coupling measured by CBO, RFC,
                                                                    methods
CA; size is measured by WMC, NPM; inheritance is
measured by DIT, NOC.                                              (Pro&Pub
                                                                   No of        21     2536      266       6232       6414      15476
In the experiment, a maximum number of Java classes
in the selected systems were examined. The considered               public
systems varied not only in size but also in domain.
                                                                   methods
System 1, a small compiler project system has 34
classes. System 2, an open source GNU Java Server                  Size         3.9    172.9 180           770        1030      2157.9
Pages (JSP) has 318 classes. System 3, a metric system
                                                                    in
for calculating Chidamber and Kemerer metrics has 383
classes. System 4, a Java based tool from OpenCms                  (KB)
systems has 1055 classes. System 5, a mathematical
database tool has 1460 classes. Some of the
characteristics of the selected systems are presented in
Table1.1. The environment for the computation of the
Chidamber and Kemerer metric consist of a Java
Scanning tool to scan the system source codes used in
this study in order to extract data about classes such as
                                                                                 System       System Metric
the number of classes in the system, number of
attributes, number of methods, and the size in repository                                            Measures
of the systems. This information was treated in a second
phase by a Chidamber and Kemerer metric tool [ 9]                            System
which was used to compute metric values for                                Source Code
LCOM,CBO, WMC, DIT, NOC, RFC, NPM and CA.                                     (Java)
The metric calculation process is presented in Figure1.2.
Descriptive Statistics (mean, median, minimum,
maximum, standard deviation) and correlation analysis                                                      Result
                                                                                 Java
(Spearman’s Correlations) were used to analyze the
                                                                                Scanner
results. Tests of hypotheses were carried out to examine
if there were relationships between cohesion and
coupling variables, cohesion and class size variables,
cohesion and inheritance, coupling and class size
variables, coupling variables and number of children,                                                             Metric
                                                                               ClassesData
coupling and inheritance variables.                                                                               Tool

.                                                                         Figure 1.2 Metric calculation process




                                                             The remainder of this study is organized as follows: section 2
                                                             examines the approaches to measuring software complexity.




                                                       177                               http://sites.google.com/site/ijcsis/
                                                                                         ISSN 1947-5500
                                                             (IJCSIS) International Journal of Computer Science and Information Security,
                                                                                                                 Vol. 9, No. 6, June 2011
 Section 3 presents the empirical study. Section 4 presents the           A method with a low cyclomatic complexity is generally
 result and discussion .                                                  better. According to Rosenberg [6] this may imply decreased
                                                                          testing and increased understandability or that decisions are
                                                                          deferred through message passing, not that the method is not
                                                                          complex . Cyclomatic complexity cannot be used to measure
       II.   MEASURING SOFWARE COMPLEXITY                                 the complexity of a class because of inheritance, but the
                                                                          cyclomatic complexity of individual methods can be combined
A.    Linesof code, Statement counts and Related Metrics                  with other measures to evaluate the complexity of the class.
    The lines of code measure counts the number of lines of               Other measures of software complexity are WMC, RFC,
code in a program and uses that number as a measure of                    LCOM, CBO, DIT, NOC as explained in section 1.
complexity. If then bugs appear at 1% per line, a 1000 line
program should have 10 bugs at least. If it takes an average of
say 20 tests to find a bug, the expected number of tests needed                             III.   EMMPIRICAL STUDY
per line of code can be inferred from this empirically. Some of
the difficulties with lines of code can be overcome by using              A.    Cohesion
statement counts instead. The problem of using statement                      Class Cohesion is a measure of the degree of relatedness
counts is that there is no unique way to count statements in              among the members of a class (or module). In object-oriented
some languages, and there is no simple rule for defining                  programming the module is the individual class (or component
statements across different languages. In addition, just as there         in the context of software reuse). Ideally, a class should
is subjectivity in applying lines of code, there is also                  represent a single responsibility. A class is cohesive when all
subjectivity in deciding what is and what is not to be called a           elements are related to the performance of a single function. A
statement for some languages.                                             class that is not cohesive poses several problems. First, it is
                                                                          difficult to understand; second, it assumes that the abstractions
B.   Size
                                                                          that it represents are always in a one-to one correspondence;
    The Size of a class is used to evaluate the ease of                   lastly one may have to specialize (through inheritance) a class
understanding of code by developers and software                          along different dimensions. A cohesive class on the other hand
maintainers. Size can be measured in a variety of ways such as            offers the following:
counting all physical lines of code, the number of statements,                • A cohesive class or a class with high cohesion allows
the number of blank lines, and the number of comment lines.                        ease of maintainability, reusability.       Hence, the
Non comment Non Blank (NCNB) is sometimes referred to as                           cohesion of a class allows measurement of its structure
Source Lines of Code and counts all lines that are not                             quality .
comments and not blanks. Executable Statement (EXEC) is a
count of executable statements regardless of number of                         •   High cohesion indicates good class subdivision. A
                                                                                   highly cohesive module should stand alone. Therefore
physical lines of code.
                                                                                   high cohesion is a desirable property of software
C.   Comment Percentage                                                            components.
   The comment percentage is calculated by the total number                    Lack of cohesion (or low cohesion) increases the likelihood
of comments divided by the total lines less the number of                      of errors during the software development process. Classes
blank lines. Since comments assist developers and                              with low cohesion could probably be subdivided into two or
maintainers,    higher   comment       percentages  increase                   more subclasses with increased cohesion [3,4].
understandability and maintainability.
                                                                          B. Coupling
D.    Maccabe’s Metric (Cyclomatic Complexity)
                                                                          Coupling is the degree of interconnection between software
    This metric is used to evaluate the complexity of an
                                                                          classes (or modules). One objective of any good design is to
algorithm in a method. It is the count of the number of test
                                                                          minimize coupling between modules. Being able to quantify
cases that are needed to test the method comprehensively. The
                                                                          and measure coupling is one of the ways to assess the quality
formula for calculating the cyclomatic complexity is the
                                                                          of a software using coupling as a design attribute. The
number of edges minus the number of nodes plus 2. For a
                                                                          definition of coupling applies to Myer’s view of coupling [10]
sequence where there is only one path, no choices or option,
                                                                          and his five fold classification of coupling from the non-
only one test case is needed. An IF loop however, has two
                                                                          desirable case to the best desirable case. Design guidelines
choices, if the condition is true, one path is tested; if the
                                                                          suggest that data coupling is the desirable form of class (or
condition is false, an alternative path is tested. Examples of
                                                                          module) communication. In general, coupling between classes
calculations of cyclomatic complexity for some basic
                                                                          (or modules) has been said to affect reuse, extendibility
programming structures are discussed in [6,8]. Hence,
                                                                          (flexibility), and comprehensibility of systems in the following
Cyclomatic Complexity => Number of independent test paths
                                                                          ways:
                             = No. of edges – No. of nodes + 2                • The higher the degree / level of coupling, the harder it
                                                                                   is to make changes to individual classes (modules)



                                                                    178                               http://sites.google.com/site/ijcsis/
                                                                                                      ISSN 1947-5500
                                                                            (IJCSIS) International Journal of Computer Science and Information Security,
                                                                                                                                Vol. 9, No. 6, June 2011
            since the changes are likely to affect a large number of
            other modules.
                                                                                      B.      Descriptive Statistics for System 2
      •     The higher the level of coupling, the lower the reuse of                                          Table 4.2 Descriptive statistics for system 2
            class (or module)                                                         Statistics    W        D          N             C         R           L            C          N
      •     The higher the level of coupling, the harder the class                                  M        I          O             B         F           C            A          P
            (or module) is understood                                                               C        T          C             O         C           OM                      M
                                                                                      N             318      318        318           318       318         318          318        318
C.    Measures of Size
                                                                                      Valid         318      318        318           318       318         318          318        318
    Several measures have been classified as size measures
                                                                                      Missing       3        3          3             3         3           3            3          3
[2]. With respect to code measures, there are: Lines of
Code(LOC), No of statements, Number of Modules, Number                                Mean          9.71     1.16       4.09E-        .75       18.17       93.94        .56        7.97
of procedures, Halstead’s length, Number of occurrences of                                                              02
operators, Number of unique operators. Number of executable                           Median        5.00     1.00       .00           .00       7.00        3.00         .00        4.00
statements (NStms) is also used for code level assessment of                          Std. Dev      12.52    2.25       .25           2.18      28.07       490.02       1.53       8.36
lines of code.With respect to design level measurement, No
                                                                                      Min           0        1          0             0         0           0            0          0
of Methods (NM), or Number of Public methods (NPM) and
No. of Attributes (Natt) are size measures . Other size                               Max           118      41         3             16        182         6075         10         40
measures which although are meant to capture other concepts,                                                                                  Cohesion: [0≤median≤1]
but are indeed size measures include, Weighted Methods Per
Class (WMC), and No of Children (NOC).
                                                                                      C.      Descriptive Statistics for System 3
                                                                                                                 Table 4.3 Descriptive statistics system 3
            IV.     RESULT FROM THE TEST SYSTEMS
                                                                                      Statistics    WMC          DIT     NOC          CBO        RFC         LCOM            CA          NPM
   Descriptive statistics and correlation analysis results of
applying a Chidamber and Kemerer metric tool in the                                   N             383          383     383          383        383         383             383         383
experimental study of the selected test systems are presented.                        Valid         383          383     383          383        383         383             383         383
                                                                                      Missing       0            0       0            0          0           0               0           0
    Descriptive statistics were used to obtain the minimum,
                                                                                      Mean          8.24         2.14    .58          8.33       20.93       150.40          5.70        6.97
maximum, mean, median, and standard deviation values for the
test systems as shown in tables 4.1–4.5.             In case of                       Median        3.00         2.00    .00          5.00       10.00       1.00            3.00        2.00
measurement for cohesion, the LCOM value lies between a                               Std. Dev      19.16        1.16    3.00         20.07      31.14       1318.02         14.02       18.63
range [0, maximum]. From Chidamber and Kemerer’s                                      Min           0            1       0            0          0           0               0           0
interpretation of their LCOM metric, a class is cohesive if its                       Max           118          5       36           195        265         16290           157         181
LCOM =0. Using descriptive statistics, a median value in this
                                                                                                                                              Cohesion: [0≤median≤1]
range [0≤median≤1] shows the class is cohesive. Hence
systems 1,3,5 are cohesive while systems 2, 4 are not cohesive.
A detailed discussion on this is already presented in [7,8].
                                                                                      D.      Descriptive Statistics for System 4
                                                                                                   Table 4.4 Descriptive statistics system 4
A.        Descriptive Statistics for System 1
             Table 4.1 Descriptive statistics for system 1                            Statistics    WMC          DIT        NOC        CBO          RFC         LCOM         CA          NPM

Statistic     W        D       N       C        R      L      CA       N              N             1055         1055       1055       1055         1055        1055         1055        1055

s             M        I       O       B        F      C               P              Valid         1055         1055       1055       1055         1055        1055         1055        1055

              C        T       C       O        C      OM              M              Missing       0            0          0          0            0           0            0           0

N             34       34      34      34       34     34     34       34             Mean          7.96         1.42       .36        6.25         26.49       44.91        1.69        5.91

Valid         34       34      34      34       34     34     34       34             Median        5.00         1.00       .00        3.00         16.00       6.00         .00         4.00

Missing       3        3       3       3        3      3      3        3              Std. Dev      9.40         .62        3.00       7.55         30.93       180.45       5.83        6.82

Mean          7.8      1.4     .41     5.5      22.    79.0   4.2      6.1            Min           0            1          0          0            0           0            0           0

Median        4.0      1.0     .00     5.0      18.    .00    2.0      4.0            Max           109          4          64         65           210         2744         71          61

Std. Dev      13.      .50     1.5     5.8      24.    440.   4.7      8.6                                                      Cohesion : [0≤median≤1]

Min           0        1       0       0        0      0      0        0
Max           74       2       8       31       12     2531   22       45
                                              Cohesion: [0≤median≤1]




                                                                                179                                              http://sites.google.com/site/ijcsis/
                                                                                                                                 ISSN 1947-5500
                                                                           (IJCSIS) International Journal of Computer Science and Information Security,
                                                                                                                               Vol. 9, No. 6, June 2011
E.      Descriptive Statistics for System 5                                            H. Correlation Analysis for System 3
             Table 4.5 Descriptive statistics system 5                                 In System 3, there were strong significant relationship
Statistics    W        D       N       C       R         L        CA      N            between cohesion and coupling (CBO, RFC), cohesion and
              M        I       O       B       F         C                P            size (WMC, NPM), coupling and size (WMC, NPM); a low
                                                                                       relationship between coupling by CA. (table 5.3)
              C        T       C       O       C         OM               M
N             1460     1460    1460    1460    1460      1460     1460    1460
              1460     1460    1460    1460    1460      1460     1460    1460
                                                                                       I.    Correlation Analysis for System 4
Valid
Missing       0        0       0       0       0         0        0       0
                                                                                       In System 4, there were strong significant relationship between
                                                                                       cohesion and coupling (RFC), cohesion and size (WMC, NPM),
Mean          5.51     1.26    .20     4.34    15.78     25.29    1.78    4.39
                                                                                       size WMC and Size NPM. There were low relationships
Median        3.00     1.00    .00     3.00    8.00      1.00     1.00    2.00         between cohesion and coupling (CBO, CA) and weak
Std. Dev      8.20     .61     1.42    5.37    20.33     283.08   3.79    7.53         relationships between inheritance DIT and CA, inheritance and
Min           0        1       0       0       0         0        0       0            size (WMC) (table 5.4).
Max           141      5       35      56      270       9870     50      141
                                              Cohesion: [0≤median≤1]                   J.       Correlation Analysis for System 5
                                                                                                In System 5, there were strong significant relationship
          Using Pearson correlation coefficients, tests of                                      between cohesion (LCOM) and size (WMC, NPM),
  hypotheses were carried out to examine if there were                                          coupling (CBO, RFC) and size (WMC, NPM); a low
  significant relationships between cohesion and coupling:                                      relationship between cohesion and             coupling,
  LCOM and CBO, LCOM and RFC, LCOM and CA; cohesion                                             inheritance (DIT) and coupling (CBO), coupling and
  and size: LCOM and WMC, LCOM and NPM; and coupling                                            size (table 5.5)
  and size: CBO and WMC, CBO and NPM, RFC and WMC,
  RFC and NPM, CA and WMC, CA and NPM; coupling by                                                TABLE 5.1        CORRELATION ANALYSIS FOR SYSTEM 1
  CBO and RFC; coupling by CBO and CA; coupling by RFC
  and CA; coupling and number of children: CBO and NOC,                                                                           Correlations
  RFC and NOC, CA and NOC; cohesion and inheritance:                                                        WMC            DIT       NOC     CBO          RFC LCOM           CE       NPM
  LCOM and DIT; coupling and inheritance: CBO and DIT,                                  WMC Pearson Corre 1.000            -.234     -.063    .897**       .926** .881**    -.054      .984**
  RFC and DIT,CA and DIT; size by WMC and NPM; size and                                     Sig. (2-tailed)    .            .183      .721    .000         .000    .000      .760      .000
  inheritance: WMC and DIT, NPM and DIT (Tables                                             N                 34              34        34      34           34      33        34        34
                                                                                        DIT Pearson Corre -.234            1.000     -.230   -.054        -.170 -.155       -.442**   -.244
  5.1-5.5). The relationship is established at the 0.01 level (2                            Sig. (2-tailed) .183               .      .191    .761         .337    .388      .009      .165
tailed) because software systems measured at code level are akin                            N                 34              34        34      34           34      33        34        34
to medical systems while the 0.05 level is suited for social                            NOC Pearson Corre -.063            -.230     1.000   -.110        -.102 -.047        .280     -.082
systems and survey studies as established in [8]. Additionally, at                          Sig. (2-tailed) .721            .191         .    .537         .566    .797      .109      .643
the 0,01 level of significance, relationships could strong (p≥.5),                          N                 34              34        34      34           34      33        34        34
                                                                                        CBO Pearson Corre .897**           -.054     -.110   1.000         .968** .769**    -.251      .895**
low (0≤p≤.5), and weak (p.< 0).                                                             Sig. (2-tailed) .000            .761      .537       .         .000    .000      .153      .000
                                                                                            N                 34              34        34      34           34      33        34        34
                                                                                        RFC Pearson Corre .926**           -.170     -.102    .968**      1.000    .785**   -.140      .924**
F.      Correlation Analysis for System 1                                                   Sig. (2-tailed) .000            .337      .566    .000            .    .000      .429      .000
                                                                                            N                 34              34        34      34           34      33        34        34
        There were strong significant relationships                   between           LCOMPearson Corre .881**           -.155     -.047    .769**       .785** 1.000     -.113      .800**
        cohesion and coupling (CBO, RFC), cohesion                    and size              Sig. (2-tailed) .000            .388      .797    .000         .000       .      .530      .000
        (WMC,NPM), coupling and size variables                         (WMC,                N                 33              33        33      33           33      33        33        33
        NPM), and a weak relationship between                         Affarent          CE Pearson Corre -.054             -.442**    .280   -.251        -.140 -.113       1.000     -.045
        coupling CA and inheritance (DIT) (table 5.1).                                      Sig. (2-tailed) .760            .009      .109    .153         .429    .530         .      .802
                                                                                            N                 34              34        34      34           34      33        34        34
G.      Correlation Analysis for System 2                                               NPM Pearson Corre .984**           -.244     -.082    .895**       .924** .800**    -.045     1.000
                                                                                            Sig. (2-tailed) .000            .165      .643    .000         .000    .000      .802         .
        In System 2, there were strong significant relationship                             N                 34              34        34      34           34      33        34        34
        between cohesion and coupling (CBO, RFC), cohesion and                              **.Correlation is significant at the 0.01 level (2-tailed).
        size variables (WMC, NPM), coupling and size (WMC,
        NPM); a low significant relationship between coupling by
        CA and WMC, NOC, and a weak relationship between
        inheritance DIT and WMC, RFC, NPM (table 5.2).




                                                                                 180                                             http://sites.google.com/site/ijcsis/
                                                                                                                                 ISSN 1947-5500
                                                                           (IJCSIS) International Journal of Computer Science and Information Security,
                                                                                                                               Vol. 9, No. 6, June 2011
      TABLE 5.2        CORRELATION ANALYSIS FOR SYSTEM 2                             TABLE 5.4      CORRELATION ANALYSIS FOR SYSTEM 4

                                         Correlations
                                                                                                                         Correlations
                         WMC DIT NOC CBO RFC LCOM CA             NPM
     WMCPearson Corr 1.000 .049 -.040 .265** .792** .810** .102 .786**                                    WMC DIT NOC CBO RFC LCOM CA                  NPM
         Sig. (2-tailed)    . .381 .478 .000 .000 .000 .069 .000                      WMCPearson Corr 1.000 -.104** .102** .420** .758** .765** .212** .846**
         N                318  318   318  318   318   318   318    318                    Sig. (2-tailed)     . .001 .001 .000 .000 .000 .000 .000
     DIT Pearson Corr .049 1.000 -.012 .064 .044 -.013 .012 .081                          N               1055 1055 1055 1055 1055 1055 1055 1055
         Sig. (2-tailed) .381    . .835 .257 .437 .821 .834 .150                      DIT Pearson Corr -.104** 1.000 -.043 .077* -.016 -.040 -.136** -.057
         N                318  318   318  318   318   318   318    318                    Sig. (2-tailed) .001      . .162 .012 .613 .191 .000 .064
     NOC Pearson Corr -.040 -.012 1.000 -.010 -.039 -.018 .038 -.080                      N               1055 1055 1055 1055 1055 1055 1055 1055
         Sig. (2-tailed) .478 .835     . .861 .488 .746 .495 .156                     NOC Pearson Corr .102** -.043 1.000 .062* .050 .077* .518** .114**
         N                318  318   318  318   318   318   318    318                    Sig. (2-tailed) .001 .162       . .045 .106 .013 .000 .000
     CBO Pearson Corr .265** .064 -.010 1.000 .716** .092 .281** .077                     N               1055 1055 1055 1055 1055 1055 1055 1055
         Sig. (2-tailed) .000 .257 .861     . .000 .103 .000 .169                     CBO Pearson Corr .420** .077* .062* 1.000 .793** .298** .055 .270**
         N                318  318   318  318   318   318   318    318                    Sig. (2-tailed) .000 .012 .045        . .000 .000 .075 .000
     RFC Pearson Corr .792** .044 -.039 .716**1.000 .571** .211** .523**                  N               1055 1055 1055 1055 1055 1055 1055 1055
         Sig. (2-tailed) .000 .437 .488 .000      . .000 .000 .000                    RFC Pearson Corr .758** -.016 .050 .793** 1.000 .610** .084** .572**
         N                318  318   318  318   318   318   318    318                    Sig. (2-tailed) .000 .613 .106 .000         . .000 .006 .000
     LCO Pearson Corr .810** -.013 -.018 .092 .571**1.000 .033 .343**                     N               1055 1055 1055 1055 1055 1055 1055 1055
         Sig. (2-tailed) .000 .821 .746 .103 .000       . .554 .000                   LCO Pearson Corr .765** -.040 .077* .298** .610** 1.000 .090** .654**
         N                318  318   318  318   318   318   318    318                    Sig. (2-tailed) .000 .191 .013 .000 .000           . .003 .000
     CA Pearson Corr .102 .012 .038 .281** .211** .033 1.000 .027                         N               1055 1055 1055 1055 1055 1055 1055 1055
         Sig. (2-tailed) .069 .834 .495 .000 .000 .554                                CA Pearson Corr .212** -.136** .518** .055 .084** .090** 1.000 .188**
                                                              . .634
         N                                                                                Sig. (2-tailed) .000 .000 .000 .075 .006 .003             . .000
                          318  318   318  318   318   318   318    318
                                                                                          N               1055 1055 1055 1055 1055 1055 1055 1055
     NPM Pearson Corr .786** .081 -.080 .077 .523** .343** .027 1.000
                                                                                      NPM Pearson Corr .846** -.057 .114** .270** .572** .654** .188** 1.000
         Sig. (2-tailed) .000 .150 .156 .169 .000 .000 .634          .
                                                                                          Sig. (2-tailed) .000 .064 .000 .000 .000 .000 .000                .
         N                318  318   318  318   318   318   318    318
                                                                                          N               1055 1055 1055 1055 1055 1055 1055 1055
       **.
         Correlation is significant at the 0.01 level (2-tailed).
                                                                                       **.
                                                                                         Correlation is significant at the 0.01 level (2-tailed).
                                                                                       *.Correlation is significant at the 0.05 level (2-tailed).




TABLE 5.3      CORRELATION ANALYSIS FOR SYSTEM 3                                     TABLE 5.5      CORRELATION ANALYSIS FOR SYSTEM 5

                                                                                                                             Correlations
                                  Correlations                                                               WMC DIT NOC CBO RFC LCOM CA NPM
                                                                                          WMCPearson Cor 1.000 .014 .094** .309** .833** .625** .243** .967**
                    WMC DIT NOC CBO RFC LCOM CA NPM
 WMCPearson Cor 1.000 -.211** .002 .889** .849** .822** .268** .992**                         Sig. (2-tailed    . .593 .000 .000 .000 .000 .000 .000
     Sig. (2-tailed    . .000 .968 .000 .000 .000 .000 .000                                   N              1460 1460 1460 1460 1460 1460 1460 1460
     N               383  383     383  383    383    383    383    383                    DIT Pearson Cor .014 1.000 .017 .080** .040 -.016 .065* .023
 DIT Pearson Cor -.211**1.000 -.027 -.131* -.268** -.105* -.130* -.191**                      Sig. (2-tailed .593    . .507 .002 .129 .539 .012 .389
     Sig. (2-tailed .000    . .595 .010 .000 .041 .011 .000                                   N              1460 1460 1460 1460 1460 1460 1460 1460
     N               383  383     383  383    383    383    383    383                    NOC Pearson Cor .094** .017 1.000 .045 .065* .032 .497** .096**
 NOC Pearson Cor .002 -.027 1.000 .000 -.006 -.017 .249** -.014                               Sig. (2-tailed .000 .507     . .089 .014 .217 .000 .000
     Sig. (2-tailed .968 .595       . .993 .914 .740 .000 .791                                N              1460 1460 1460 1460 1460 1460 1460 1460
     N               383  383     383  383    383    383    383    383                    CBO Pearson Cor .309** .080** .045 1.000 .661** .091** .231** .238**
 CBO Pearson Cor .889** -.131* .000 1.000 .807** .782** .225** .892**                         Sig. (2-tailed .000 .002 .089      . .000 .000 .000 .000
     Sig. (2-tailed .000 .010 .993       . .000 .000 .000 .000                                N              1460 1460 1460 1460 1460 1460 1460 1460
     N               383  383     383  383    383    383    383    383                    RFC Pearson Cor .833** .040 .065* .661**1.000 .385** .252** .759**
 RFC Pearson Cor .849** -.268** -.006 .807**1.000 .547** .144** .813**                        Sig. (2-tailed .000 .129 .014 .000       . .000 .000 .000
     Sig. (2-tailed .000 .000 .914 .000         . .000 .005 .000                              N              1460 1460 1460 1460 1460 1460 1460 1460
     N               383  383     383  383    383    383    383    383                    LCO Pearson Cor .625** -.016 .032 .091** .385**1.000 .089** .625**
 LCO Pearson Cor .822** -.105* -.017 .782** .547**1.000 .332** .843**                         Sig. (2-tailed .000 .539 .217 .000 .000         . .001 .000
     Sig. (2-tailed .000 .041 .740 .000 .000           . .000 .000                            N              1460 1460 1460 1460 1460 1460 1460 1460
     N               383  383     383  383    383    383    383    383                    CA Pearson Cor .243** .065* .497** .231** .252** .089**1.000 .174**
 CA Pearson Cor .268** -.130* .249** .225** .144** .332**1.000 .274**                         Sig. (2-tailed .000 .012 .000 .000 .000 .001           . .000
     Sig. (2-tailed .000 .011 .000 .000 .005 .000             . .000                          N              1460 1460 1460 1460 1460 1460 1460 1460
     N               383  383     383  383    383    383    383    383                    NPM Pearson Cor .967** .023 .096** .238** .759** .625** .174**1.000
 NPM Pearson Cor .992** -.191** -.014 .892** .813** .843** .274**1.000                        Sig. (2-tailed .000 .389 .000 .000 .000 .000 .000             .
     Sig. (2-tailed .000 .000 .791 .000 .000 .000 .000               .                        N              1460 1460 1460 1460 1460 1460 1460 1460
     N               383  383     383  383    383    383    383    383                      **.
                                                                                              Correlation is significant at the 0.01 level (2-tailed).
  **.
    Correlation is significant at the 0.01 level (2-tailed).                                *.Correlation is significant at the 0.05 level (2-tailed).
  *.Correlation is significant at the 0.05 level (2-tailed).




                                                                               181                                          http://sites.google.com/site/ijcsis/
                                                                                                                            ISSN 1947-5500
                                                             (IJCSIS) International Journal of Computer Science and Information Security,
                                                                                                                 Vol. 9, No. 6, June 2011
                     V.    DISCUSSION

                                                                                                         REFERENCES
Using Pearson Correlation, and the research questions and
hypotheses investigated in section 1.3 and 1.4 as well as the
                                                                          [1]   R. Adammov, and L. Richter, “A proposal for structural complexity
correlation results shown in tables 5.1-5.5, it can be                                of program, “ . Journal of Systems and Software vol. 12, 1990,
concluded as follows:                                                           pp. 55-70.
                                                                          [2]   V. R. Basili, L. C. Briand, and W. Melo, “A validation of Object
   •   There is significant correlation between the cohesion                    oriented design metrics as qaulity indicators” , IEEE Trans. On software
       variable LCOM and coupling variables CBO and/or                          engineering, vol. 22, no. 10, 1996, pp. 751-761
       RFC, CA across the systems . This confirms research                [3]   S. R. Chidamber and C. F. Kemerer, “Towards a metric suite for Object
                                                                                oriented design,” object oriented programming systems, languages and
       question 1. The Significance means that the                              applications, special issue of SIGPLAN notices 26, vol. 10, 1991, pp.
       relationship is not merely statistical (not by chance); it               197-211.
       is a real relationship due to the underlying behavior of           [4]   S. R. Chidamber and C. F. Kemerer, “A metric suite for Object oriented
       the systems. It is expected that high cohesion should                    design,” IEEE trans. on software engineering vol. 26, no. 6, 1994, pp.
       mean low coupling and vice versa. For systems 1, 3,                      476-493.
       and 5, at least 50% of the total number of classes were            [5]   N. Gorla and R. Ramakrishnan , “Effect of Software Structure
       cohesive (see table 4.1- 4.5). It should be observed that                attributes on software development, ” Journal of systems and software
                                                                                vol. 36, no. 2. 1997, pp. 191-199.
       the median values from descriptive statistics for these
       cohesive system are either 0 or 1 whereas the median
       values for systems 2 and 4 are 3.0 and 6.0 respectively.           [6]  L. H. Rosenberg, “Applying and interpreting object oriented metrics “
                                                                               retrieved            October          10,         2005            from
   •   There is significant correlation between cohesion and                   http://www.satc.gsfc.nasa.gov/support/STC_APR98/apply_OO/apply_O
                                                                               O.html
       number of methods in a class NPM across the systems
                                                                          [7] E. Okike, “A pedagogical evaluation and discussion about the Lack of
       (research question (ii)). Tables 5.1 show significant                   Cohesion in Methods metric (LCOM) using field experiments, “
       correlations between LCOM and WMC, NPM. A high                          International Journal of computer science issues, vol. 2, no. 3, march
       number of methods in a class should mean low                            2010, pp. 36-43.
       cohesion. This is confirmed in [8] . Classes with high             [8] E. U. Okike, “Measuring class cohesion in object oriented systems
       number of public methods NPM are not cohesive,                          using Chidamber and Kemerer metrics and Java as case study,”
       while classes with low NPM (at least less than 5) are                   unpublished Ph.D thesis, Department of computer science, university of
                                                                               Ibadan, xvii+ 133pp, 2007.
       cohesive. This agrees with the suggestion that in the
       design of classes, less than 5 methods should be in the            [9] D. Spinellis, “Ckjm – A tool for calculating Chidamber and Kemerer
                                                                               Java metrics, ” retrieved December 15, 2005 from
       class to be cohesive, otherwise the class could be split
                                                                              http://www.spinellis.gr/sw/ckjm/doc/indexw.html
       into two or more classes [3,4].
   •   There is no significant correlation between cohesion               [10] W. Stevens, G. Myers and L. Constantine, “Structured design, “ IBM
       and inheritance (research question (iii)), as shown in                  systems Journal, vol. 13, no. 2, 1974, pp. 115-139.
       tables 5.1– 5.5.                                                   [11] H. Zuse, “A framework for software mmeasurement. New York: Walter
                                                                               de Gruyter, 1989.
   •   There is significant correlation between coupling and
       number of methods (see tables 5.1-5.5). High coupling
                                                                                                     AUTHORS PROFILE
       could mean high number of methods and vice versa.
                                                                          Ezekiel U Okike is a Senior Lecturer in the Department of commputer
       From the tables 5.1-5.5, CBO correlates significantly                   science, University of Ibadan, Nigeria. He holds a B. S computer
       with WMC and NPM; RFC correlates significantly                          Science, MInf (Information Science) and a Ph. D in computer science
       with NPM (research question iv). A high number of                       from the University of Ibadan, Nigeria.
       public methods in a class could mean high coupling                 Adenike O. Osofisan is a Professor of Computer Science and Head,
       [8]. Also in table 5.6, most classes with high RFC                      Department of Computer Science, University of Ibadan, Nigeria.
       values also had high NPM values.
   •   There is low or weak correlation between coupling and
       inheritance as shown in tables 5.1-5.5.




                                                                    182                                    http://sites.google.com/site/ijcsis/
                                                                                                           ISSN 1947-5500