Page 199 - DCAP305_PRINCIPLES_OF_SOFTWARE_ENGINEERING
P. 199

Unit 9: Metrics



            9.3.1 Definition of PSI (Percentage of Shared Ideas)                                  Notes
            Although the semantic metrics proposed by are not subject to distortions due to programming
            language or programmer style as traditional metrics are, they still have one obstacle: they require
            a knowledge base with a conceptual graph structure in order to be calculated. Not all knowledge
            bases have such a structure. Therefore, proposed semantic metrics, including PSI, that can be
            calculated using any knowledge base that associates.
            Concepts or keywords with classes and their member functions, regardless of how the knowledge
            base is implemented.
            The PSI is the number of concepts or keywords shared by at least two member functions of a
            class, divided by the number of concepts or keywords belonging to any member function in
            the class. PSI for class Ca is defined as follows.
                                      | {
                                                      x
                                     xx Œ I ^ $ i jx Œ I ^ Œ I )}
                                              ,(
                                                    ai
                                                          aj
                                           a
                               PSI =
                                        {|    I ^ $ k y ( Œ I )}
                                         yy Œ
                                                      ak
                                              a
            For 1_ i, j, k _ |Fa|, or 0 if no ideas are associated with any function of the class.
            For example, define class Ca to contain four member functions and a total of ten ideas (concepts
            or  keywords  from  the  knowledge  base)  associated  with  member  functions  to  make  up  the
            following sets: Ia1 = {i3, i4, i5}, Ia2 = {i4, i5, i6}, Ia3 = {i1, i2}, and Ia4 = {i6, i7, i8, i9, i10}.
            In this example, ideas i4, i5, and i6 are common to at least two member functions; the others
            are not. Therefore, PSI for class Ca = 3/10 = 0.30.
            9.3.2 Syntactic Cohesion Metrics
            One of the majority usually cited suites of metrics is that proposed by Chidamber and Kemerer
            Chidamber and Kemerer proposed these metrics, many people have analyzed, criticized, and
            proposed their own versions of these metrics. We will compare the performance of PSI to six
            versions of LCOM (lack of PSI= (1). (See Table 9.2)

                              Table 9.2: Definition of Various LCOM Matrices

                         Definition                                       Reference
                 LCOM    LCOM  =  the  set  of  pairs  of  member  functions  with  no   [9]
                         instance variable used by both members in the pair
                 LCOM1 [13] added the constraint that a pair of member functions   [13]
                         containing a member function and itself should not be
                         counted. Inherited instance variables are not counted.
                 LCOM2 [8] specified a pair of member functions could not include   [8]
                         the member function and itself. Inherited instance variables
                         do not count.
                 LCOM3 An undirected graph has edges that are pairs of member   [23] [19]
                         functions with at least one attribute  variable in common.
                         LCOM3 = number of connected components of the graph.
                 LCOM4 A variation of LCOM in which there is an edge in the graph   [19]
                         for each function that calls another function in addition to
                         the edges for functions that share attribute variables.
                 LCOM5 LCOM 5 is specified from the perspective of the number of   [13]
                         functions accessing each attribute.





                                             LOVELY PROFESSIONAL UNIVERSITY                                   193
   194   195   196   197   198   199   200   201   202   203   204