SlideShare ist ein Scribd-Unternehmen logo
1 von 127
A New Reusability Metric for
       Object-Oriented Software
       JUDITH BARNARD*
       Department of Computing, The Open University, Milton Keynes, MK7 6AA, UK
       Received August 1997

        Angggha Satya Nugraha
        Irene Ully Havsa
        Indah Kuntum Khairina




* This paper was written whilst the author was a research associate on the MOODproject at the Department of Computer Science, University of
Warwick, Coventry, CV4 7AL, UK
Introduction
• The benefit of reuse:
  - Reducing project cost
  - Reducing project time
  - Improving software quality


   Make it more maintainable
Motivation
• How can the developer measure the reusability
  of their software’s component?
• What guidelines can developers take to ensure
  they are developing reusable software?




              METRIC
Motivation
Why metric?
With a reusability metric, a component can be
given a value for reusability that will
determine if it reusable or not!

Then, what’s the factors that include in reusability
metric?
Discussion on Reusability
                     Class metrics
                     Attribute metrics
Reusability metric
                     Method metrics

                     Method input parameter
                     metrics
Class Metrics
Class Factors                Quantifier
Coupling (Foreign classes)   Coupling between object classes (CBO)
Number of methods            Number of methods
Number of attributes         Number of attributes
Meaningful name              Rating 1-5 (1-low, 5-high)
Documentation                Number of words in text existing ‘outside’ of the program
Lines of code                Number of non-comment source code lines
Comment lines                Number of comment lines per line of code
Depth of inheritance         Depth of inheritance tree (DIT)
Number of children           Number of children (NOC)
Cohesion                     Lack of cohesion in method (LCOM)
Class variables              Number of class variables per line of code
                                                                           Go to discussion
Attribute Metrics
Attribute factors            Quantifier
Meaningful name              Rating 1 to 5 (1-low, 5-high)
Complexity of data structure Number of sub-types




                                                    Go to discussion
Method Metrics
Method factors             Quantifier
Meaningful name            Rating 1 to 5 (1-low, 5-high)
Functions performed        Number of functions performed
Lines of code              Number of non-comment source code lines
Interface parameters       Number of input parameters
Calls to foreign classes   Number of calls to foreign classes per line of code
Calls to library classes   Number of calls to library classes per line of code
Robustness                 Coverage of input parameters satisfied – expressed
                           as fraction between 0 and 1, 0-no coverage, 1-full
                           coverage
Complexity                 McCabe complexity measure
Instance variables         Number of instance variables per line of code
Access                     Public, protected or private
                                                                        Go to discussion
Method Input Parameter Metrics
Method input parameter factors   Quantifier
Meaningful name                  Rating 1 to 5 (1-low, 5-high)
Parameter complexity             Number of sub-types
Empirical Work
• This section contains the result of 2 experiments
  that were carried out
• Steps:
  1. Making highly reusable code and highly
     unreusable code
  2. Taking metrics from both types of code
  3. Analyzing the results
  4. Making some deduction
Experiment 1
Developer A
   was asked to write the code in a very unreusable
   manner and would be difficult to reuse elsewhere.

Developer B
   was instructed to write the code in the most reusable
   manner possible.
Compare both sets of classes (the
quantifiers, identified above, were applied to each
piece of code and their values compared).
Result Experiment 1 (Class)




                              Go to conclusion
Result Experiment 1 (Attribute)




                             Go to conclusion
Result Experiment 1 (Method - A)




                             Go to conclusion
Result Experiment 1 (Method - B)




                             Go to conclusion
Result Experiment 1 (Inp.param)




                            Go to conclusion
Conclusion Experiment 1 (Class)
• Some interesting information arises from these
  results. Both CBO and LCOM differ widely
  between the reusable and unreusable code.
       Reusable: low             Reusable: 0
CBO                       LCOM
       Unreusable: high          Unreusable: high

• Other factors do not show any trend between
  reusable and unreusable code
                                               See the result
Conclusion Experiment 1 (Attribute
and Inp.param)

• Show general trend of needing to be simple.




                                            See the result
                                            See the result
Conclusion Experiment 1 (Method)

           Reusable Code        Unreusable Code
Perform only one function       Perform not always one
Has no calls to foreign class   Has calls to foreign class



 • The remaining factors i.e lines of code, number of
   input parameter do not provide any useful
   information.


                                                             See the result
                                                             See the result
Conclusion Experiment 1
• Experiment 1 was a quick, easy experiment to
  show where the general trends between reusable
  and unreusable code lie, in terms of the factors
  chosen.
• To confirm and enhance any theories that have
  been arisen, further experiments must be carried
  out.
Experiment 2
• This experiment involves the analysis of a wide
  selection of reusable classes taken from well
  used and accepted programming libraries.

• By taking a significant number of classes in this
  study (30 classes in this case with over 200
  methods), we will show any trends that can be
  taken literally.
Experiment 2
• From any graphs below, we are looking for
  factors that give a constant trend for all the
  classes. Those that vary widely for all the
  different classes we can assume to be unrelated
  to reusability.
Experiment 2
The graph related to class metrics:
Experiment 2
Experiment 2
Experiment 2
Experiment 2
The graph related to attribute metrics:
Experiment 2
The graph related to method metrics:
Experiment 2
Experiment 2
Experiment 2
The graph related to input parameter metrics:
Result Experiment 2
• The graphs that show a constant trend for all the
  classes are related to the following factors: CBO
  for foreign classes (always zero), class
  documentation, meaningful names (for
  class, method, attribute and parameters), DIT
  (low values – 0 or 1), the number of functions
  within a method.
Result Experiment 2
• The graphs that do not show a constant trend for
  all the classes are related to the following
  factors: number of methods and attributes in a
  class, number of lines of code and comment
  lines, LCOM, number of input
  parameters, method complexity and the number
  of instance variables.
• The next section discusses these results and puts
  forward a model and metric of reusability.
New Reusability Metric
• Reusability metric for object-oriented software:
New Reusability Metric
• A new reusability metric can derive from the list
  above.
New Reusability Metric (Formula)
   • The reusability metric, Reusability, for a class is
     defined as:
                                        >10: reusable
                                      cm                              ca
Reusability R    Rc  m      R c a           m i                             a j
                                      i 1                             j 1

where
Rc         MD c       MN c            CBO+DIT+1                                           <5 : unreusable
                                                p
Rm   i
             MN       m i
                              +MCi +                Rp   k
                                                                 p            NFi +NFCi
                                            k 1


Rp   k
            MN p          PCi     k
                                      1     or       Rp      k
                                                                     5 if p       0

Ra   f
             MN       a   j
                                  AC j      1
cm         number of methods in class
ca        number of attributes in class
p        number of input parameter of method i
i, j , k     variable integers
Reusability Metric in Ours
______________________________
 Aplikasi Reusability Metric pada
       Kode Sumber Tugas 1
Class Diagram                                                                     CShape
                                                                   #border: char
                                                                   #fill: char
                                                                   #selected: boolean                                         CRect
                                                                   #screen: Screen                           #top: int
                    Screen
                                                                  +Contains(int, int): boolean               #left: int
      -screenRows: int                                            +Intersects(int, int, int, int): boolean   #bottom: int
      -screenColumns: int                                         +DrawFill(): void                          #right: int
      #pixels: int[][]                                       0..* +DrawShape(): void
                                                   1                                                         +Contains(int, int): boolean
                                                                  +DrawHandle(): void                        +Intersects(int, int, int, int): boolean
      +DrawPixel(int, int, char): void
                                                                  +OnResizeHandle(int, int): boolean         +DrawFill(): void
      +ErasePixel(int, int): void
                                                                  +Resize(int, int): void                    +DrawShape(): void
      +EraseRegion(int, int, int, int): void
                                                                  +Move(int, int): void                      +DrawHandle(): void
      +EraseAll(): void
                                                                   +Draw(): void                             +OnResizeHandle(int, int): boolean
      +Refresh(): void
                                                                   +Drag(int, int, int, int): void           +Resize(int, int): void
                                                           0..*    +SetBorder(char): void                    +Move(int, int): void
                         1                                         +SetFill(char): void
                                                                   +Select(): void
                                                                   +Unselect(): void
                         1                     1                   +Selected(): boolean
               DrawingPackage
                                                                                                                             CTextBox
                                                                                        0..*
  -screen: Screen
  -shapes: ShapeList                                                                                                  -fillText: String
  -currentBorder: char                                                                  1                             +DrawFill(): void
  -currentFill: char
                                                                                 ShapeList
  +Initial(): void
  +Interact(): void                                               -maxObject: int                                            CCircle
  +ApplyDragTool(char, int, int, int, int): void                  -shapes: CShape[]
  +RedrawAll(): void                                   1          -totalShapes: int                          -centrex: int
                                                             1                                               -centrey: int
                                                                  +AddShape(CShape): void                    -radius: int
                         1                                        +RemoveShape(CShape): void
                                                                  +FirstShapeContaining(int, int): CShape    +Contains(int, int): boolean
                                                                  +Select(int, int, int, int): void          +Intersects(int, int, int, int): boolean
                                                                  +UnselectAll(): void                       +DrawFill(): void
                         1
                                                                  +RemoveSelected(): void                    +DrawShape(): void
                       Tool                                       +SetBorderOfSelected(char): void           +DrawHandle(): void
                                                                  +SetFillOfSelected(char): void             +OnResizeHandle(int, int): boolean
       -drawingPackage: DrawingPackage
                                                                  +DrawAll(): void                           +Resize(int, int): void
       +main(String[]): void                                      +Reorder(): void                           +Move(int, int): void
CBO                   DIT
Coupling Between
                   Depth of Inheritance
     Object

               CLASS

      MN                  MD
                       Meaningful
Meaningful Name
                       Description
Coupling between Object Classes
              • Banyaknya kelas lain yang digunakan oleh suatu
  Definisi      kelas


              • CBO semakin kecil  semakin reusable
 Hubungan



              • Jumlah kelas lain yang terhubung dari kelas A oleh
Perhitungan     hubungan asosiasi (non-inheritance)


Acceptable
              •0–1
  range
Coupling between Object Classes (2)
• Contoh CBO untuk kelas Tool:




  CBO = 1
Coupling between Object Classes (3)
• CBO setiap kelas pada aplikasi Character Graphics:
                         Kelas    CBO
                   Tool           1
                   DrawingPackage 3
                   Screen         0
                   ShapeList      1
                   CShape         1
                   CRect          1
                   CCircle        1
                   CTextBox       1
Depth of Inheritance Tree
              • Jarak maksimum dari suatu simpul ke akar pada
  Definisi      inheritance tree


              • DIT semakin kecil  semakin reusable
Hubungan



              • Jarak maksimum dari kelas A ke root pada
Perhitungan     inheritance tree


Acceptable
              •0–1
  range
Depth of Inheritance Tree (2)
• DIT setiap kelas pada aplikasi Character Graphics:
                          Kelas    DIT
                    Tool           0
                    DrawingPackage 0
                    Screen         0
                    ShapeList      0
                    CShape         0
                    CRect          1
                    CCircle        1
                    CTextBox       2
Meaningful Name
              • Tingkat kejelasan kegunaan class dilihat dari
  Definisi      namanya


              • MN semakin besar  semakin reusable
Hubungan



              • Tergantung asumsi & kebutuhan pihak
Perhitungan     developer, juga bahasa yang digunakan


Acceptable
              •4–5
  range
Meaningful Name (2)
• Asumsi yang kami gunakan:
  ▫ Dalam Bahasa Inggris : +1
  ▫ Berupa kata benda : +1
  ▫ ‘Camel case’ : +1
  ▫ Menggambarkan kegunaan class : +2
Meaningful Name (3)
• Contoh MN untuk kelas DrawingPackage:




                         Penilaian :
                         • Dalam Bahasa Inggris : +1
                         • Berupa kata benda : +1
                         • ‘Camel case’ : +1
                         • Menggambarkan kegunaan kelas : +2

                         MN = 5
Meaningful Name (4)
• MN setiap kelas pada aplikasi Character Graphics:
                         Kelas    MNc
                   Tool           5
                   DrawingPackage 5
                   Screen         5
                   ShapeList      5
                   CShape         5
                   CRect          4
                   CCircle        5
                   CTextBox       5
Meaningful Description
              • Tingkat kejelasan kegunaan class dilihat dari
  Definisi      deskripsi/dokumentasinya.


              • MD semakin besar  semakin reusable
Hubungan




              • Tergantung asumsi & kebutuhan pihak developer
Perhitungan




Acceptable
              •4–5
  range
Meaningful Description (2)
• Asumsi yang kami gunakan:
  ▫ Ada deskripsi kelas : +2
  ▫ Ada deskripsi atribut : +1
  ▫ Ada deskripsi method : +1
  ▫ Ada dokumentasi eksternal : +1
Meaningful Description (3)
• Contoh MD untuk kelas CTextBox:




                                    Penilaian :
                                    • Ada deskripsi kelas : +2
                                    • Ada deskripsi atribut : +1
                                    • Ada deskripsi method : +1
                                    • Ada dokumentasi eksternal : 0

                                    MD = 4
Meaningful Description (4)
• MD setiap kelas pada aplikasi Character Graphics:
                         Kelas    MDc
                   Tool           0
                   DrawingPackage 3
                   Screen         0
                   ShapeList      1
                   CShape         0
                   CRect          3
                   CCircle        0
                   CTextBox       4
Perhitungan Rc
•

            Kelas       Rc
    Tool            2.5
    DrawingPackage 2
    Screen          5
    ShapeList       3
    CShape          2.5
    CRect           2.33
    CCircle         1.67
    CTextBox        2.25
AC                  MN
Attribute Complexity   Meaningful Name


               ATTRIBUTE
Attribute Complexity
              • Kompleksitas struktur data dari atribut
  Definisi




              • AC semakin kecil  semakin reusable
Hubungan




              • Jumlah sub-tipe dari atribut
Perhitungan




Acceptable
              •0–1
  range
Attribute Complexity (2)
• Contoh AC untuk atribut shapes pada kelas ShapeList:




                        Perhitungan:
                        Atribut shapes memiliki tipe Cshape,
                        CShape memiliki 3 subtipe, yaitu:
                        • CRect
                        • CCircle
                        • CTextBox

                        Sehingga untuk shapes, AC = 3
Attribute Complexity (3)
• Class Tool
  Nama Atribut      Tipe Atribut        AC
  drawingPackage    DrawingPackage      0


• Class DrawingPackage
   Nama Atribut    Tipe Atribut    AC
   screen          Screen          0
   shapes          ShapeList       0
   currentBorder   char            0
   currentFill     char            0
Attribute Complexity (4)
• Class Screen
   Nama Atribut    Tipe Atribut   AC
   screenRows      int            0
   screenColumns   int            0
   pixels          char[][]       0



• Class ShapeList
   Nama Atribut    Tipe Atribut        AC
   maxObjects      int                 0
   shapes          Cshape[]            3
   totalShapes     int                 0
Attribute Complexity (5)
• Class CShape
   Nama Atribut   Tipe Atribut     AC
   border         char             0
   fill           char             0
   selected       boolean          0
   screen         Screen           0


• Class CCircle
   Nama Atribut     Tipe Atribut        AC
   centrex          int                 0
   centrey          int                 0
   radius           int                 0
Attribute Complexity (6)
• Class CRect
   Nama Atribut   Tipe Atribut     AC
   top            int              0
   left           int              0
   bottom         int              0
   right          int              0


• Class CTextBox
   Nama Atribut     Tipe Atribut        AC
   fillText         String              0
Meaningful Name
              • Tingkat kejelasan kegunaan atribut dilihat dari
  Definisi      namanya


              • MN semakin besar  semakin reusable
Hubungan



              • Tergantung asumsi & kebutuhan pihak developer,
Perhitungan     juga bahasa yang digunakan


Acceptable
              •4–5
  range
Meaningful Name (2)

• Asumsi yang kami gunakan:
  ▫ Dalam Bahasa Inggris : +1
  ▫ ‘Mixed case’ : +1
  ▫ Menggambarkan kegunaan atribut: +3
Meaningful Name (3)
• Contoh MN untuk atribut drawingPackage pada kelas Tool:




                          Penilaian :
                          • Dalam Bahasa Inggris : +1
                          • ‘Mixed case’ : +1
                          • Menggambarkan kegunaan atribut: +3

                          MN = 5
Meaningful Name (4)
• Class Tool
  Nama Atribut         MNa
  drawingPackage       5


• Class DrawingPackage
   Nama Atribut    MNa
   screen          5
   shapes          5
   currentBorder   5
   currentFill     5
Meaningful Name (5)
• Class Screen
   Nama Atribut    MNa
   screenRows      5
   screenColumns   5
   pixels          5



• Class ShapeList
   Nama Atribut    MNa
   maxObjects      5
   shapes          5
   totalShapes     5
Meaningful Name (6)
• Class CShape
   Nama Atribut   MNa
   border         5
   fill           5
   selected       5
   screen         5


• Class CCircle
   Nama Atribut       MNa
   centrex            5
   centrey            5
   radius             5
Meaningful Name (7)
• Class CRect
   Nama Atribut   MNa
   top            5
   left           5
   bottom         5
   right          5


• Class CTextBox
   Nama Atribut       MNa
   fillText           5
Perhitungan Ra
•                     Kelas     Ra
                 Tool           5
                 DrawingPackage 5
                 Screen         5
                 ShapeList     3.75
                 CShape        5
                 CRect         5
                 CCircle       5
                 CTextBox      5
NF                  NFC
Number of Function   Number of Calls to
   Performed          Foreign Classes

               METHOD

      MN                   MC
Meaningful Name      Method Coverage
Number of Function Performed
              • Jumlah fungsi yang dijalankan sebuah method
  Definisi




              • NF semakin kecil  semakin reusable
Hubungan




              • Jumlah tanda “ ; ” yang bukan pada variabel lokal
Perhitungan




Acceptable
              •1
  range
Number of Function Performed (2)
• Method RemoveShape pada Class ShapeList




                                        NF = 2
Number of Function Performed (3)
• Class Tool             • Class Screen
  Nama Method     NF        Nama Method   NF
  main            2         DrawPixel     1
                            ErasePixel    1
• Class DrawingPackage      EraseRegion   1
  Nama Method     NF        EraseAll      1
  Initial         2         Refresh       1
  Interact        5
  ApplyDragTool   2
  RedrawAll       5
Number of Function Performed (4)
• Class ShapeList
   Nama Method           NF
   AddShape              1
   RemoveShape           2
   FirstShapeContaining 1
   Select                1
   UnselectAll           1
   RemoveSelected        2
   SetBorderOfSelected   1
   SetFillOfSelected     1
   DrawAll               1
   Reorder               1
Number of Function Performed (5)
• Class CShape
  Nama Method         NF
  Draw                3
  Drag                2
  SetBorder           1
  SetFill             1
  Select              1
  Unselect            1
  Selected            1

  Untuk Abstract method langsung di CRect dan CCircle
Number of Function Performed (6)
• Class CRect            • Class CCircle
   Nama Method      NF      Nama Method      NF
   Contains         1       Contains         1
   Intersects       1       Intersects       1
   DrawFill         1       DrawFill         1
   DrawShape        1       DrawShape        1
   DrawHandle       1       DrawHandle       1
   OnResizeHandle   1       OnResizeHandle   1
   Resize           2       Resize           1
   Move             4       Move             2
Number of Function Performed (7)
• Class CTextBox
  Nama Method      NF
  DrawFill         1
Number of Calls to Foreign Classes
              • Jumlah pemanggilan method atau constructor dari
  Definisi      class lain


              • NFC semakin kecil  semakin reusable
 Hubungan



              • Jumlah distinct class yang method-nya digunakan
Perhitungan     (tidak termasuk library)


Acceptable
              •0–1
  range
Number of Calls to Foreign Classes (2)
• Method Select pada Class ShapeList




                                       NFC = 1
Number of Calls to Foreign Classes (3)
• Class Tool             • Class Screen
  Nama Method     NFC       Nama Method   NF
  main            1         DrawPixel     0
                            ErasePixel    0
• Class DrawingPackage      EraseRegion   0
  Nama Method     NFC       EraseAll      0
  Initial         0         Refresh       0
  Interact        1
  ApplyDragTool   2
  RedrawAll       1
Number of Calls to Foreign Classes (4)
• Class ShapeList
   Nama Method           NFC
   AddShape              0
   RemoveShape           0
   FirstShapeContaining 1
   Select                1
   UnselectAll           1
   RemoveSelected        1
   SetBorderOfSelected   1
   SetFillOfSelected     1
   DrawAll               1
   Reorder               1
Number of Calls to Foreign Classes (5)
• Class CShape
  Nama Method         NFC
  Draw                0
  Drag                0
  SetBorder           0
  SetFill             0
  Select              0
  Unselect            0
  Selected            0

  Untuk Abstract method langsung di CRect dan CCircle
Number of Calls to Foreign Classes (6)
• Class CRect             • Class CCircle
   Nama Method      NFC      Nama Method      NFC
   Contains         0        Contains         0
   Intersects       0        Intersects       0
   DrawFill         1        DrawFill         1
   DrawShape        1        DrawShape        1
   DrawHandle       1        DrawHandle       1
   OnResizeHandle   0        OnResizeHandle   0
   Resize           0        Resize           0
   Move             0        Move             0
Number of Calls to Foreign Classes (7)
• Class CTextBox
  Nama Method      NFC
  DrawFill         1
Method Coverage
              • Tingkat cakupan validasi terhadap nilai – nilai yang
  Definisi      digunakan dalam method


              • NFC semakin kecil  semakin reusable
Hubungan



              • Nilai awal = 1. Jika ada validitas yang tidak di-
Perhitungan     handle, nilai berkurang x poin (misal 0.1)


Acceptable
              •1
  range
Method Coverage (2)
• Method Interact pada Class DrawingPackage




                                MC = 1 – 4*(0.1)
                                   = 0.6
Method Coverage (3)
• Class Tool             • Class Screen
  Nama Method     MC        Nama Method   MC
  main            1         DrawPixel     1
                            ErasePixel    1
• Class DrawingPackage      EraseRegion   1
  Nama Method     MC        EraseAll      1
  Initial         1         Refresh       1
  Interact        0.6
  ApplyDragTool   1
  RedrawAll       1
Method Coverage (4)
• Class ShapeList
   Nama Method           MC
   AddShape              1
   RemoveShape           1
   FirstShapeContaining 1
   Select                1
   UnselectAll           1
   RemoveSelected        1
   SetBorderOfSelected   1
   SetFillOfSelected     1
   DrawAll               1
   Reorder               1
Method Coverage (5)
• Class CShape
  Nama Method         MC
  Draw                1
  Drag                1
  SetBorder           1
  SetFill             1
  Select              1
  Unselect            1
  Selected            1

  Untuk Abstract method langsung di CRect dan CCircle
Method Coverage (6)
• Class CRect            • Class CCircle
   Nama Method      MC      Nama Method      MC
   Contains         1       Contains         1
   Intersects       1       Intersects       1
   DrawFill         1       DrawFill         1
   DrawShape        1       DrawShape        1
   DrawHandle       1       DrawHandle       1
   OnResizeHandle   1       OnResizeHandle   1
   Resize           1       Resize           1
   Move             1       Move             1
Method Coverage (7)
• Class CTextBox
  Nama Method      MC
  DrawFill         1
Meaningful Name
              • Tingkat kejelasan kegunaan method dilihat dari
  Definisi      namanya


              • MN semakin besar  semakin reusable
Hubungan



              • Tergantung asumsi & kebutuhan pihak
Perhitungan     developer, juga bahasa yang digunakan


Acceptable
              •4–5
  range
Meaningful Name (2)

• Asumsi yang kami gunakan:
  ▫ Dalam Bahasa Inggris : +1
  ▫ Berupa kata kerja : +1
  ▫ ‘Mixed case’ : +1
  ▫ Menggambarkan kegunaan method : +2
Meaningful Name (3)
• Method FirstShapeContaining pada Class ShapeList




                      Penilaian :
                      • Dalam Bahasa Inggris : +1
                      • Berupa kata kerja : 0
                      • ‘Mixed case’ : 0
                      • Menggambarkan kegunaan method : +2

                      MN = 3
Meaningful Name (3)
• Class Tool             • Class Screen
  Nama Method     MNm       Nama Method   MNm
  main            5         DrawPixel     4
                            ErasePixel    4
• Class DrawingPackage      EraseRegion   4
  Nama Method     MNm       EraseAll      4
  Initial         3         Refresh       4
  Interact        4
  ApplyDragTool   4
  RedrawAll       4
Meaningful Name (4)
• Class ShapeList
   Nama Method           MNm
   AddShape              4
   RemoveShape           4
   FirstShapeContaining 3
   Select                4
   UnselectAll           4
   RemoveSelected        4
   SetBorderOfSelected   4
   SetFillOfSelected     4
   DrawAll               4
   Reorder               4
Meaningful Name (5)
• Class CShape
  Nama Method         MNm
  Draw                4
  Drag                4
  SetBorder           4
  SetFill             4
  Select              4
  Unselect            4
  Selected            3

  Untuk Abstract method langsung di CRect dan CCircle
Meaningful Name (6)
• Class CRect             • Class CCircle
   Nama Method      MNm      Nama Method      MNm
   Contains         4        Contains         4
   Intersects       4        Intersects       4
   DrawFill         4        DrawFill         4
   DrawShape        4        DrawShape        4
   DrawHandle       4        DrawHandle       4
   OnResizeHandle   3        OnResizeHandle   3
   Resize           4        Resize           4
   Move             4        Move             4
Meaningful Name (7)
• Class CTextBox
  Nama Method      MNm
  DrawFill         4
MN                PC
                   Parameter
Meaningful Name
                   Complexity

             INPUT
           PARAMETER
Meaningful Name
              • Tingkat kejelasan kegunaan parameter dilihat dari
  Definisi      namanya


              • MN semakin besar  semakin reusable
Hubungan



              • Tergantung asumsi & kebutuhan pihak developer,
Perhitungan     juga bahasa yang digunakan


Acceptable
              •4–5
  range
Meaningful Name (2)

• Asumsi yang kami gunakan:
  ▫ Dalam Bahasa Inggris : +1
  ▫ ‘Mixed case’ : +1
  ▫ Menggambarkan kegunaan parameter : +3
Meaningful Name (3)
• Method Drag pada Class CShape


 Penilaian :
 1. startx
      • Dalam Bahasa Inggris : +1
      • ‘Mixed case’ : +1
      • Menggambarkan kegunaan parameter: +3
      • MN = 5

 2. starty, endx, dan endy
       • idem
Meaningful Name (4)
• Class Tool
  Nama Method     Parameter   MNp
  main            argv        5

• Class DrawingPackage
  Nama Method     Parameter   MNp
  ApplyDragTool   tool        5
                  startx      5
                  starty      5
                  endx        5
                  endy        5
Meaningful Name (5)
• Class Screen
  Nama Method    Parameter   MNp
  DrawPixel      x           5
                 y           5
                 value       5
  ErasePixel     x           5
                 y           5
  EraseRegion    x1          5
                 y1          5
                 x2          5
                 y2          5
Meaningful Name (6)
• Class ShapeList
   Nama Method            Parameter   MNp
   AddShape               shape       5
   RemoveShape            shape       5
   FirstShapeContaining   px          5
                          py          5
   Select                 top         5
                          left        5
                          bottom      5
                          right       5
   SetBorderOfSelected    border      5
   SetFillOfSelected      fill        5
Meaningful Name (7)
• Class CShape
  Nama Method         Parameter    MNp
  Drag                startx       5
                      starty       5
                      endx         5
                      endy         5
  SetBorder           border       5
  SetFill             fill         5



  Untuk Abstract method langsung di CRect dan CCircle
Meaningful Name (8)
• Class CRect   Nama Method      Parameter   MNp
                Contains         px          5
                                 py          5
                Intersects       dtop        5
                                 dleft       5
                                 dbottom     5
                                 dright      5
                OnResizeHandle   px          5
                                 py          5
                Resize           dx          5
                                 dy          5
                Move             dx          5
                                 dy          5
Meaningful Name (8)
• Class CCircle   Nama Method      Parameter   MNp
                  Contains         px          5
                                   py          5
                  Intersects       dtop        5
                                   dleft       5
                                   dbottom     5
                                   dright      5
                  OnResizeHandle   px          5
                                   py          5
                  Resize           dx          5
                                   dy          5
                  Move             dx          5
                                   dy          5
Parameter Complexity
              • Kompleksitas struktur data dari parameter
  Definisi




              • PC semakin kecil  semakin reusable
Hubungan




              • Jumlah sub-tipe parameter
Perhitungan




Acceptable
              •1
  range
Parameter Complexity (2)
• Method AddShape ada ShapeList




                      Perhitungan:
                      Cshape memiliki 3 subtipe, yaitu:
                      • CRect
                      • CCircle
                      • CTextBox

                      Sehingga untuk shape, PC = 3
Parameter Complexity (4)
• Class Tool
  Nama Method     Nama Parameter   Tipe Parameter   PC
  main            argv             String[]         0

• Class DrawingPackage
  Nama Method     Nama Parameter   Tipe Parameter   PC
  ApplyDragTool   tool             char             0
                  startx           int              0
                  starty           int              0
                  endx             int              0
                  endy             int              0
Parameter Complexity (4)
• Class Screen
  Nama Method    Nama Parameter   Tipe Parameter   PC
  DrawPixel      x                int              0
                 y                int              0
                 value            char             0
  ErasePixel     x                int              0
                 y                int              0
  EraseRegion    x1               int              0
                 y1               int              0
                 x2               int              0
                 y2               int              0
Parameter Complexity (5)
• Class ShapeList
   Nama Method            Nama Parameter   Tipe Parameter   PC
   AddShape               shape            CShape           3
   RemoveShape            shape            CShape           3
   FirstShapeContaining   px               int              0
                          py               int              0
   Select                 top              int              0
                          left             int              0
                          bottom           int              0
                          right            int              0
   SetBorderOfSelected    border           char             0
   SetFillOfSelected      fill             char             0
Parameter Complexity (6)
• Class CShape
  Nama Method     Nama Parameter     Tipe Parameter     PC
  Drag            startx             int                0
                  starty             int                0
                  endx               int                0
                  endy               int                0
  SetBorder       border             char               0
  SetFill         fill               char               0



  Untuk Abstract method langsung di CRect dan CCircle
Parameter Complexity (7)
• Class CRect   Nama Method      Nama Parameter   Tipe Parameter   PC
                Contains         px               int              0
                                 py               int              0
                Intersects       dtop             int              0
                                 dleft            int              0
                                 dbottom          int              0
                                 dright           int              0
                OnResizeHandle   px               int              0
                                 py               int              0
                Resize           dx               int              0
                                 dy               int              0
                Move             dx               int              0
                                 dy               int              0
Parameter Complexity (9)
• Class CCircle   Nama Method      Nama Parameter   Tipe Parameter   PC
                  Contains         px               int              0
                                   py               int              0
                  Intersects       dtop             int              0
                                   dleft            int              0
                                   dbottom          int              0
                                   dright           int              0
                  OnResizeHandle   px               int              0
                                   py               int              0
                  Resize           dx               int              0
                                   dy               int              0
                  Move             dx               int              0
                                   dy               int              0
Perhitungan Rm
•
                     Kelas        Rm
                 Tool           3.67
                 DrawingPackage 2.57
                 Screen         10
                 ShapeList      4.72
                 CShape         7.89
                 CRect          6.44
                 CCircle        7.38
                 CTextBox       5
Reusable Class?
Class Tool
•
Class DrawingPackage
•
Class Screen
•
Class ShapeList
•
Class CShape
•
Class CRect
•
Class CCircle
•
Class CTextBox
•
Terima Kasih 

Weitere ähnliche Inhalte

Was ist angesagt?

C++ OOP Implementation
C++ OOP ImplementationC++ OOP Implementation
C++ OOP Implementation
Fridz Felisco
 

Was ist angesagt? (19)

A Feature-Based Model for Nested Named-Entity Recognition at VLSP-2018 NER Ev...
A Feature-Based Model for Nested Named-Entity Recognition at VLSP-2018 NER Ev...A Feature-Based Model for Nested Named-Entity Recognition at VLSP-2018 NER Ev...
A Feature-Based Model for Nested Named-Entity Recognition at VLSP-2018 NER Ev...
 
1909 BERT: why-and-how (CODE SEMINAR)
1909 BERT: why-and-how (CODE SEMINAR)1909 BERT: why-and-how (CODE SEMINAR)
1909 BERT: why-and-how (CODE SEMINAR)
 
From UML/OCL to natural language (using SBVR as pivot)
From UML/OCL to natural language (using SBVR as pivot)From UML/OCL to natural language (using SBVR as pivot)
From UML/OCL to natural language (using SBVR as pivot)
 
Transformer Seq2Sqe Models: Concepts, Trends & Limitations (DLI)
Transformer Seq2Sqe Models: Concepts, Trends & Limitations (DLI)Transformer Seq2Sqe Models: Concepts, Trends & Limitations (DLI)
Transformer Seq2Sqe Models: Concepts, Trends & Limitations (DLI)
 
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
BERT: Pre-training of Deep Bidirectional Transformers for Language UnderstandingBERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
 
OOP in C++
OOP in C++OOP in C++
OOP in C++
 
Transformers to Learn Hierarchical Contexts in Multiparty Dialogue
Transformers to Learn Hierarchical Contexts in Multiparty DialogueTransformers to Learn Hierarchical Contexts in Multiparty Dialogue
Transformers to Learn Hierarchical Contexts in Multiparty Dialogue
 
OODP Unit 1 OOPs classes and objects
OODP Unit 1 OOPs classes and objectsOODP Unit 1 OOPs classes and objects
OODP Unit 1 OOPs classes and objects
 
ReusingMT
ReusingMTReusingMT
ReusingMT
 
Lecture05
Lecture05Lecture05
Lecture05
 
Keywords, identifiers ,datatypes in C++
Keywords, identifiers ,datatypes in C++Keywords, identifiers ,datatypes in C++
Keywords, identifiers ,datatypes in C++
 
C LANGUAGE NOTES
C LANGUAGE NOTESC LANGUAGE NOTES
C LANGUAGE NOTES
 
Learning c - An extensive guide to learn the C Language
Learning c - An extensive guide to learn the C LanguageLearning c - An extensive guide to learn the C Language
Learning c - An extensive guide to learn the C Language
 
C after correction
C after correctionC after correction
C after correction
 
C notes
C notesC notes
C notes
 
Icpc11c.ppt
Icpc11c.pptIcpc11c.ppt
Icpc11c.ppt
 
C++ OOP Implementation
C++ OOP ImplementationC++ OOP Implementation
C++ OOP Implementation
 
C++ Basics
C++ BasicsC++ Basics
C++ Basics
 
Pc module1
Pc module1Pc module1
Pc module1
 

Andere mochten auch

Software quality
Software qualitySoftware quality
Software quality
jagadeesan
 
Sistemas De Riego
Sistemas De RiegoSistemas De Riego
Sistemas De Riego
csemidei
 

Andere mochten auch (20)

JavaOne’12 Session 3992 - Software Modularity: Paradoxes, Principles, and Arc...
JavaOne’12 Session 3992 - Software Modularity: Paradoxes, Principles, and Arc...JavaOne’12 Session 3992 - Software Modularity: Paradoxes, Principles, and Arc...
JavaOne’12 Session 3992 - Software Modularity: Paradoxes, Principles, and Arc...
 
Marketing Agility: The Missing Metric?
Marketing Agility: The Missing Metric?Marketing Agility: The Missing Metric?
Marketing Agility: The Missing Metric?
 
Confidentiality ppt[1] (1)
Confidentiality ppt[1] (1)Confidentiality ppt[1] (1)
Confidentiality ppt[1] (1)
 
How to define Quality Models for Measuring Software Quality
How to define Quality Models for Measuring Software QualityHow to define Quality Models for Measuring Software Quality
How to define Quality Models for Measuring Software Quality
 
Sa 006 modifiability
Sa 006 modifiabilitySa 006 modifiability
Sa 006 modifiability
 
14 software technical_metrics
14 software technical_metrics14 software technical_metrics
14 software technical_metrics
 
Agile Metrics : A seminal approach for calculating Metrics in Agile Projects
Agile Metrics : A seminal approach for calculating Metrics in Agile ProjectsAgile Metrics : A seminal approach for calculating Metrics in Agile Projects
Agile Metrics : A seminal approach for calculating Metrics in Agile Projects
 
Agile Metrics That Matter
Agile Metrics That MatterAgile Metrics That Matter
Agile Metrics That Matter
 
Software Engineering unit 3
Software Engineering unit 3Software Engineering unit 3
Software Engineering unit 3
 
Software Quality Metrics for Testers - StarWest 2013
Software Quality Metrics for Testers - StarWest 2013Software Quality Metrics for Testers - StarWest 2013
Software Quality Metrics for Testers - StarWest 2013
 
Software Measurement: Lecture 2. Function Point Analysis
Software Measurement: Lecture 2. Function Point AnalysisSoftware Measurement: Lecture 2. Function Point Analysis
Software Measurement: Lecture 2. Function Point Analysis
 
Non Functional Requirement.
Non Functional Requirement.Non Functional Requirement.
Non Functional Requirement.
 
Software Measurement: Lecture 1. Measures and Metrics
Software Measurement: Lecture 1. Measures and MetricsSoftware Measurement: Lecture 1. Measures and Metrics
Software Measurement: Lecture 1. Measures and Metrics
 
Software quality
Software qualitySoftware quality
Software quality
 
Software Metrics
Software MetricsSoftware Metrics
Software Metrics
 
Software Measurement: Lecture 3. Metrics in Organization
Software Measurement: Lecture 3. Metrics in OrganizationSoftware Measurement: Lecture 3. Metrics in Organization
Software Measurement: Lecture 3. Metrics in Organization
 
Software quality
Software qualitySoftware quality
Software quality
 
Sistemas De Riego
Sistemas De RiegoSistemas De Riego
Sistemas De Riego
 
Software quality assurance
Software quality assuranceSoftware quality assurance
Software quality assurance
 
13 software metrics
13 software metrics13 software metrics
13 software metrics
 

Ähnlich wie A New Reusability Metric for Object-Oriented Software

Coursebreakup
CoursebreakupCoursebreakup
Coursebreakup
PCTE
 
Code Analysis-run time error prediction
Code Analysis-run time error predictionCode Analysis-run time error prediction
Code Analysis-run time error prediction
NIKHIL NAWATHE
 

Ähnlich wie A New Reusability Metric for Object-Oriented Software (20)

Coursebreakup
CoursebreakupCoursebreakup
Coursebreakup
 
C material
C materialC material
C material
 
Code metrics in PHP
Code metrics in PHPCode metrics in PHP
Code metrics in PHP
 
Metrics ekon 14_2_kleiner
Metrics ekon 14_2_kleinerMetrics ekon 14_2_kleiner
Metrics ekon 14_2_kleiner
 
Computer programming questions
Computer programming questionsComputer programming questions
Computer programming questions
 
Coursebreakup
CoursebreakupCoursebreakup
Coursebreakup
 
Programming in C [Module One]
Programming in C [Module One]Programming in C [Module One]
Programming in C [Module One]
 
C basics
C basicsC basics
C basics
 
C basics
C basicsC basics
C basics
 
C++ Made simple .pptx
C++ Made simple .pptxC++ Made simple .pptx
C++ Made simple .pptx
 
Finding Defects in C#: Coverity vs. FxCop
Finding Defects in C#: Coverity vs. FxCopFinding Defects in C#: Coverity vs. FxCop
Finding Defects in C#: Coverity vs. FxCop
 
Code Analysis-run time error prediction
Code Analysis-run time error predictionCode Analysis-run time error prediction
Code Analysis-run time error prediction
 
Reference Scope Identification of Citances Using Convolutional Neural Network
Reference Scope Identification of Citances Using Convolutional Neural NetworkReference Scope Identification of Citances Using Convolutional Neural Network
Reference Scope Identification of Citances Using Convolutional Neural Network
 
CSharpCheatSheetV1.pdf
CSharpCheatSheetV1.pdfCSharpCheatSheetV1.pdf
CSharpCheatSheetV1.pdf
 
Introduction to c
Introduction to cIntroduction to c
Introduction to c
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and Repair
 
고급컴파일러구성론_개레_230303.pptx
고급컴파일러구성론_개레_230303.pptx고급컴파일러구성론_개레_230303.pptx
고급컴파일러구성론_개레_230303.pptx
 
Functional Programming - Worth the Effort
Functional Programming - Worth the EffortFunctional Programming - Worth the Effort
Functional Programming - Worth the Effort
 
PERFORMANCE ESTIMATION OF LDPC CODE SUING SUM PRODUCT ALGORITHM AND BIT FLIPP...
PERFORMANCE ESTIMATION OF LDPC CODE SUING SUM PRODUCT ALGORITHM AND BIT FLIPP...PERFORMANCE ESTIMATION OF LDPC CODE SUING SUM PRODUCT ALGORITHM AND BIT FLIPP...
PERFORMANCE ESTIMATION OF LDPC CODE SUING SUM PRODUCT ALGORITHM AND BIT FLIPP...
 
C# slid
C# slidC# slid
C# slid
 

Kürzlich hochgeladen

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Kürzlich hochgeladen (20)

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 

A New Reusability Metric for Object-Oriented Software

  • 1. A New Reusability Metric for Object-Oriented Software JUDITH BARNARD* Department of Computing, The Open University, Milton Keynes, MK7 6AA, UK Received August 1997 Angggha Satya Nugraha Irene Ully Havsa Indah Kuntum Khairina * This paper was written whilst the author was a research associate on the MOODproject at the Department of Computer Science, University of Warwick, Coventry, CV4 7AL, UK
  • 2. Introduction • The benefit of reuse: - Reducing project cost - Reducing project time - Improving software quality Make it more maintainable
  • 3. Motivation • How can the developer measure the reusability of their software’s component? • What guidelines can developers take to ensure they are developing reusable software? METRIC
  • 4. Motivation Why metric? With a reusability metric, a component can be given a value for reusability that will determine if it reusable or not! Then, what’s the factors that include in reusability metric?
  • 5. Discussion on Reusability Class metrics Attribute metrics Reusability metric Method metrics Method input parameter metrics
  • 6. Class Metrics Class Factors Quantifier Coupling (Foreign classes) Coupling between object classes (CBO) Number of methods Number of methods Number of attributes Number of attributes Meaningful name Rating 1-5 (1-low, 5-high) Documentation Number of words in text existing ‘outside’ of the program Lines of code Number of non-comment source code lines Comment lines Number of comment lines per line of code Depth of inheritance Depth of inheritance tree (DIT) Number of children Number of children (NOC) Cohesion Lack of cohesion in method (LCOM) Class variables Number of class variables per line of code Go to discussion
  • 7. Attribute Metrics Attribute factors Quantifier Meaningful name Rating 1 to 5 (1-low, 5-high) Complexity of data structure Number of sub-types Go to discussion
  • 8. Method Metrics Method factors Quantifier Meaningful name Rating 1 to 5 (1-low, 5-high) Functions performed Number of functions performed Lines of code Number of non-comment source code lines Interface parameters Number of input parameters Calls to foreign classes Number of calls to foreign classes per line of code Calls to library classes Number of calls to library classes per line of code Robustness Coverage of input parameters satisfied – expressed as fraction between 0 and 1, 0-no coverage, 1-full coverage Complexity McCabe complexity measure Instance variables Number of instance variables per line of code Access Public, protected or private Go to discussion
  • 9. Method Input Parameter Metrics Method input parameter factors Quantifier Meaningful name Rating 1 to 5 (1-low, 5-high) Parameter complexity Number of sub-types
  • 10. Empirical Work • This section contains the result of 2 experiments that were carried out • Steps: 1. Making highly reusable code and highly unreusable code 2. Taking metrics from both types of code 3. Analyzing the results 4. Making some deduction
  • 11. Experiment 1 Developer A was asked to write the code in a very unreusable manner and would be difficult to reuse elsewhere. Developer B was instructed to write the code in the most reusable manner possible. Compare both sets of classes (the quantifiers, identified above, were applied to each piece of code and their values compared).
  • 12. Result Experiment 1 (Class) Go to conclusion
  • 13. Result Experiment 1 (Attribute) Go to conclusion
  • 14. Result Experiment 1 (Method - A) Go to conclusion
  • 15. Result Experiment 1 (Method - B) Go to conclusion
  • 16. Result Experiment 1 (Inp.param) Go to conclusion
  • 17. Conclusion Experiment 1 (Class) • Some interesting information arises from these results. Both CBO and LCOM differ widely between the reusable and unreusable code. Reusable: low Reusable: 0 CBO LCOM Unreusable: high Unreusable: high • Other factors do not show any trend between reusable and unreusable code See the result
  • 18. Conclusion Experiment 1 (Attribute and Inp.param) • Show general trend of needing to be simple. See the result See the result
  • 19. Conclusion Experiment 1 (Method) Reusable Code Unreusable Code Perform only one function Perform not always one Has no calls to foreign class Has calls to foreign class • The remaining factors i.e lines of code, number of input parameter do not provide any useful information. See the result See the result
  • 20. Conclusion Experiment 1 • Experiment 1 was a quick, easy experiment to show where the general trends between reusable and unreusable code lie, in terms of the factors chosen. • To confirm and enhance any theories that have been arisen, further experiments must be carried out.
  • 21. Experiment 2 • This experiment involves the analysis of a wide selection of reusable classes taken from well used and accepted programming libraries. • By taking a significant number of classes in this study (30 classes in this case with over 200 methods), we will show any trends that can be taken literally.
  • 22. Experiment 2 • From any graphs below, we are looking for factors that give a constant trend for all the classes. Those that vary widely for all the different classes we can assume to be unrelated to reusability.
  • 23. Experiment 2 The graph related to class metrics:
  • 27. Experiment 2 The graph related to attribute metrics:
  • 28. Experiment 2 The graph related to method metrics:
  • 31. Experiment 2 The graph related to input parameter metrics:
  • 32. Result Experiment 2 • The graphs that show a constant trend for all the classes are related to the following factors: CBO for foreign classes (always zero), class documentation, meaningful names (for class, method, attribute and parameters), DIT (low values – 0 or 1), the number of functions within a method.
  • 33. Result Experiment 2 • The graphs that do not show a constant trend for all the classes are related to the following factors: number of methods and attributes in a class, number of lines of code and comment lines, LCOM, number of input parameters, method complexity and the number of instance variables. • The next section discusses these results and puts forward a model and metric of reusability.
  • 34. New Reusability Metric • Reusability metric for object-oriented software:
  • 35. New Reusability Metric • A new reusability metric can derive from the list above.
  • 36. New Reusability Metric (Formula) • The reusability metric, Reusability, for a class is defined as: >10: reusable cm ca Reusability R Rc m R c a m i a j i 1 j 1 where Rc MD c MN c CBO+DIT+1 <5 : unreusable p Rm i MN m i +MCi + Rp k p NFi +NFCi k 1 Rp k MN p PCi k 1 or Rp k 5 if p 0 Ra f MN a j AC j 1 cm number of methods in class ca number of attributes in class p number of input parameter of method i i, j , k variable integers
  • 37. Reusability Metric in Ours ______________________________ Aplikasi Reusability Metric pada Kode Sumber Tugas 1
  • 38. Class Diagram CShape #border: char #fill: char #selected: boolean CRect #screen: Screen #top: int Screen +Contains(int, int): boolean #left: int -screenRows: int +Intersects(int, int, int, int): boolean #bottom: int -screenColumns: int +DrawFill(): void #right: int #pixels: int[][] 0..* +DrawShape(): void 1 +Contains(int, int): boolean +DrawHandle(): void +Intersects(int, int, int, int): boolean +DrawPixel(int, int, char): void +OnResizeHandle(int, int): boolean +DrawFill(): void +ErasePixel(int, int): void +Resize(int, int): void +DrawShape(): void +EraseRegion(int, int, int, int): void +Move(int, int): void +DrawHandle(): void +EraseAll(): void +Draw(): void +OnResizeHandle(int, int): boolean +Refresh(): void +Drag(int, int, int, int): void +Resize(int, int): void 0..* +SetBorder(char): void +Move(int, int): void 1 +SetFill(char): void +Select(): void +Unselect(): void 1 1 +Selected(): boolean DrawingPackage CTextBox 0..* -screen: Screen -shapes: ShapeList -fillText: String -currentBorder: char 1 +DrawFill(): void -currentFill: char ShapeList +Initial(): void +Interact(): void -maxObject: int CCircle +ApplyDragTool(char, int, int, int, int): void -shapes: CShape[] +RedrawAll(): void 1 -totalShapes: int -centrex: int 1 -centrey: int +AddShape(CShape): void -radius: int 1 +RemoveShape(CShape): void +FirstShapeContaining(int, int): CShape +Contains(int, int): boolean +Select(int, int, int, int): void +Intersects(int, int, int, int): boolean +UnselectAll(): void +DrawFill(): void 1 +RemoveSelected(): void +DrawShape(): void Tool +SetBorderOfSelected(char): void +DrawHandle(): void +SetFillOfSelected(char): void +OnResizeHandle(int, int): boolean -drawingPackage: DrawingPackage +DrawAll(): void +Resize(int, int): void +main(String[]): void +Reorder(): void +Move(int, int): void
  • 39. CBO DIT Coupling Between Depth of Inheritance Object CLASS MN MD Meaningful Meaningful Name Description
  • 40. Coupling between Object Classes • Banyaknya kelas lain yang digunakan oleh suatu Definisi kelas • CBO semakin kecil  semakin reusable Hubungan • Jumlah kelas lain yang terhubung dari kelas A oleh Perhitungan hubungan asosiasi (non-inheritance) Acceptable •0–1 range
  • 41. Coupling between Object Classes (2) • Contoh CBO untuk kelas Tool: CBO = 1
  • 42. Coupling between Object Classes (3) • CBO setiap kelas pada aplikasi Character Graphics: Kelas CBO Tool 1 DrawingPackage 3 Screen 0 ShapeList 1 CShape 1 CRect 1 CCircle 1 CTextBox 1
  • 43. Depth of Inheritance Tree • Jarak maksimum dari suatu simpul ke akar pada Definisi inheritance tree • DIT semakin kecil  semakin reusable Hubungan • Jarak maksimum dari kelas A ke root pada Perhitungan inheritance tree Acceptable •0–1 range
  • 44. Depth of Inheritance Tree (2) • DIT setiap kelas pada aplikasi Character Graphics: Kelas DIT Tool 0 DrawingPackage 0 Screen 0 ShapeList 0 CShape 0 CRect 1 CCircle 1 CTextBox 2
  • 45. Meaningful Name • Tingkat kejelasan kegunaan class dilihat dari Definisi namanya • MN semakin besar  semakin reusable Hubungan • Tergantung asumsi & kebutuhan pihak Perhitungan developer, juga bahasa yang digunakan Acceptable •4–5 range
  • 46. Meaningful Name (2) • Asumsi yang kami gunakan: ▫ Dalam Bahasa Inggris : +1 ▫ Berupa kata benda : +1 ▫ ‘Camel case’ : +1 ▫ Menggambarkan kegunaan class : +2
  • 47. Meaningful Name (3) • Contoh MN untuk kelas DrawingPackage: Penilaian : • Dalam Bahasa Inggris : +1 • Berupa kata benda : +1 • ‘Camel case’ : +1 • Menggambarkan kegunaan kelas : +2 MN = 5
  • 48. Meaningful Name (4) • MN setiap kelas pada aplikasi Character Graphics: Kelas MNc Tool 5 DrawingPackage 5 Screen 5 ShapeList 5 CShape 5 CRect 4 CCircle 5 CTextBox 5
  • 49. Meaningful Description • Tingkat kejelasan kegunaan class dilihat dari Definisi deskripsi/dokumentasinya. • MD semakin besar  semakin reusable Hubungan • Tergantung asumsi & kebutuhan pihak developer Perhitungan Acceptable •4–5 range
  • 50. Meaningful Description (2) • Asumsi yang kami gunakan: ▫ Ada deskripsi kelas : +2 ▫ Ada deskripsi atribut : +1 ▫ Ada deskripsi method : +1 ▫ Ada dokumentasi eksternal : +1
  • 51. Meaningful Description (3) • Contoh MD untuk kelas CTextBox: Penilaian : • Ada deskripsi kelas : +2 • Ada deskripsi atribut : +1 • Ada deskripsi method : +1 • Ada dokumentasi eksternal : 0 MD = 4
  • 52. Meaningful Description (4) • MD setiap kelas pada aplikasi Character Graphics: Kelas MDc Tool 0 DrawingPackage 3 Screen 0 ShapeList 1 CShape 0 CRect 3 CCircle 0 CTextBox 4
  • 53. Perhitungan Rc • Kelas Rc Tool 2.5 DrawingPackage 2 Screen 5 ShapeList 3 CShape 2.5 CRect 2.33 CCircle 1.67 CTextBox 2.25
  • 54. AC MN Attribute Complexity Meaningful Name ATTRIBUTE
  • 55. Attribute Complexity • Kompleksitas struktur data dari atribut Definisi • AC semakin kecil  semakin reusable Hubungan • Jumlah sub-tipe dari atribut Perhitungan Acceptable •0–1 range
  • 56. Attribute Complexity (2) • Contoh AC untuk atribut shapes pada kelas ShapeList: Perhitungan: Atribut shapes memiliki tipe Cshape, CShape memiliki 3 subtipe, yaitu: • CRect • CCircle • CTextBox Sehingga untuk shapes, AC = 3
  • 57. Attribute Complexity (3) • Class Tool Nama Atribut Tipe Atribut AC drawingPackage DrawingPackage 0 • Class DrawingPackage Nama Atribut Tipe Atribut AC screen Screen 0 shapes ShapeList 0 currentBorder char 0 currentFill char 0
  • 58. Attribute Complexity (4) • Class Screen Nama Atribut Tipe Atribut AC screenRows int 0 screenColumns int 0 pixels char[][] 0 • Class ShapeList Nama Atribut Tipe Atribut AC maxObjects int 0 shapes Cshape[] 3 totalShapes int 0
  • 59. Attribute Complexity (5) • Class CShape Nama Atribut Tipe Atribut AC border char 0 fill char 0 selected boolean 0 screen Screen 0 • Class CCircle Nama Atribut Tipe Atribut AC centrex int 0 centrey int 0 radius int 0
  • 60. Attribute Complexity (6) • Class CRect Nama Atribut Tipe Atribut AC top int 0 left int 0 bottom int 0 right int 0 • Class CTextBox Nama Atribut Tipe Atribut AC fillText String 0
  • 61. Meaningful Name • Tingkat kejelasan kegunaan atribut dilihat dari Definisi namanya • MN semakin besar  semakin reusable Hubungan • Tergantung asumsi & kebutuhan pihak developer, Perhitungan juga bahasa yang digunakan Acceptable •4–5 range
  • 62. Meaningful Name (2) • Asumsi yang kami gunakan: ▫ Dalam Bahasa Inggris : +1 ▫ ‘Mixed case’ : +1 ▫ Menggambarkan kegunaan atribut: +3
  • 63. Meaningful Name (3) • Contoh MN untuk atribut drawingPackage pada kelas Tool: Penilaian : • Dalam Bahasa Inggris : +1 • ‘Mixed case’ : +1 • Menggambarkan kegunaan atribut: +3 MN = 5
  • 64. Meaningful Name (4) • Class Tool Nama Atribut MNa drawingPackage 5 • Class DrawingPackage Nama Atribut MNa screen 5 shapes 5 currentBorder 5 currentFill 5
  • 65. Meaningful Name (5) • Class Screen Nama Atribut MNa screenRows 5 screenColumns 5 pixels 5 • Class ShapeList Nama Atribut MNa maxObjects 5 shapes 5 totalShapes 5
  • 66. Meaningful Name (6) • Class CShape Nama Atribut MNa border 5 fill 5 selected 5 screen 5 • Class CCircle Nama Atribut MNa centrex 5 centrey 5 radius 5
  • 67. Meaningful Name (7) • Class CRect Nama Atribut MNa top 5 left 5 bottom 5 right 5 • Class CTextBox Nama Atribut MNa fillText 5
  • 68. Perhitungan Ra • Kelas Ra Tool 5 DrawingPackage 5 Screen 5 ShapeList 3.75 CShape 5 CRect 5 CCircle 5 CTextBox 5
  • 69. NF NFC Number of Function Number of Calls to Performed Foreign Classes METHOD MN MC Meaningful Name Method Coverage
  • 70. Number of Function Performed • Jumlah fungsi yang dijalankan sebuah method Definisi • NF semakin kecil  semakin reusable Hubungan • Jumlah tanda “ ; ” yang bukan pada variabel lokal Perhitungan Acceptable •1 range
  • 71. Number of Function Performed (2) • Method RemoveShape pada Class ShapeList NF = 2
  • 72. Number of Function Performed (3) • Class Tool • Class Screen Nama Method NF Nama Method NF main 2 DrawPixel 1 ErasePixel 1 • Class DrawingPackage EraseRegion 1 Nama Method NF EraseAll 1 Initial 2 Refresh 1 Interact 5 ApplyDragTool 2 RedrawAll 5
  • 73. Number of Function Performed (4) • Class ShapeList Nama Method NF AddShape 1 RemoveShape 2 FirstShapeContaining 1 Select 1 UnselectAll 1 RemoveSelected 2 SetBorderOfSelected 1 SetFillOfSelected 1 DrawAll 1 Reorder 1
  • 74. Number of Function Performed (5) • Class CShape Nama Method NF Draw 3 Drag 2 SetBorder 1 SetFill 1 Select 1 Unselect 1 Selected 1 Untuk Abstract method langsung di CRect dan CCircle
  • 75. Number of Function Performed (6) • Class CRect • Class CCircle Nama Method NF Nama Method NF Contains 1 Contains 1 Intersects 1 Intersects 1 DrawFill 1 DrawFill 1 DrawShape 1 DrawShape 1 DrawHandle 1 DrawHandle 1 OnResizeHandle 1 OnResizeHandle 1 Resize 2 Resize 1 Move 4 Move 2
  • 76. Number of Function Performed (7) • Class CTextBox Nama Method NF DrawFill 1
  • 77. Number of Calls to Foreign Classes • Jumlah pemanggilan method atau constructor dari Definisi class lain • NFC semakin kecil  semakin reusable Hubungan • Jumlah distinct class yang method-nya digunakan Perhitungan (tidak termasuk library) Acceptable •0–1 range
  • 78. Number of Calls to Foreign Classes (2) • Method Select pada Class ShapeList NFC = 1
  • 79. Number of Calls to Foreign Classes (3) • Class Tool • Class Screen Nama Method NFC Nama Method NF main 1 DrawPixel 0 ErasePixel 0 • Class DrawingPackage EraseRegion 0 Nama Method NFC EraseAll 0 Initial 0 Refresh 0 Interact 1 ApplyDragTool 2 RedrawAll 1
  • 80. Number of Calls to Foreign Classes (4) • Class ShapeList Nama Method NFC AddShape 0 RemoveShape 0 FirstShapeContaining 1 Select 1 UnselectAll 1 RemoveSelected 1 SetBorderOfSelected 1 SetFillOfSelected 1 DrawAll 1 Reorder 1
  • 81. Number of Calls to Foreign Classes (5) • Class CShape Nama Method NFC Draw 0 Drag 0 SetBorder 0 SetFill 0 Select 0 Unselect 0 Selected 0 Untuk Abstract method langsung di CRect dan CCircle
  • 82. Number of Calls to Foreign Classes (6) • Class CRect • Class CCircle Nama Method NFC Nama Method NFC Contains 0 Contains 0 Intersects 0 Intersects 0 DrawFill 1 DrawFill 1 DrawShape 1 DrawShape 1 DrawHandle 1 DrawHandle 1 OnResizeHandle 0 OnResizeHandle 0 Resize 0 Resize 0 Move 0 Move 0
  • 83. Number of Calls to Foreign Classes (7) • Class CTextBox Nama Method NFC DrawFill 1
  • 84. Method Coverage • Tingkat cakupan validasi terhadap nilai – nilai yang Definisi digunakan dalam method • NFC semakin kecil  semakin reusable Hubungan • Nilai awal = 1. Jika ada validitas yang tidak di- Perhitungan handle, nilai berkurang x poin (misal 0.1) Acceptable •1 range
  • 85. Method Coverage (2) • Method Interact pada Class DrawingPackage MC = 1 – 4*(0.1) = 0.6
  • 86. Method Coverage (3) • Class Tool • Class Screen Nama Method MC Nama Method MC main 1 DrawPixel 1 ErasePixel 1 • Class DrawingPackage EraseRegion 1 Nama Method MC EraseAll 1 Initial 1 Refresh 1 Interact 0.6 ApplyDragTool 1 RedrawAll 1
  • 87. Method Coverage (4) • Class ShapeList Nama Method MC AddShape 1 RemoveShape 1 FirstShapeContaining 1 Select 1 UnselectAll 1 RemoveSelected 1 SetBorderOfSelected 1 SetFillOfSelected 1 DrawAll 1 Reorder 1
  • 88. Method Coverage (5) • Class CShape Nama Method MC Draw 1 Drag 1 SetBorder 1 SetFill 1 Select 1 Unselect 1 Selected 1 Untuk Abstract method langsung di CRect dan CCircle
  • 89. Method Coverage (6) • Class CRect • Class CCircle Nama Method MC Nama Method MC Contains 1 Contains 1 Intersects 1 Intersects 1 DrawFill 1 DrawFill 1 DrawShape 1 DrawShape 1 DrawHandle 1 DrawHandle 1 OnResizeHandle 1 OnResizeHandle 1 Resize 1 Resize 1 Move 1 Move 1
  • 90. Method Coverage (7) • Class CTextBox Nama Method MC DrawFill 1
  • 91. Meaningful Name • Tingkat kejelasan kegunaan method dilihat dari Definisi namanya • MN semakin besar  semakin reusable Hubungan • Tergantung asumsi & kebutuhan pihak Perhitungan developer, juga bahasa yang digunakan Acceptable •4–5 range
  • 92. Meaningful Name (2) • Asumsi yang kami gunakan: ▫ Dalam Bahasa Inggris : +1 ▫ Berupa kata kerja : +1 ▫ ‘Mixed case’ : +1 ▫ Menggambarkan kegunaan method : +2
  • 93. Meaningful Name (3) • Method FirstShapeContaining pada Class ShapeList Penilaian : • Dalam Bahasa Inggris : +1 • Berupa kata kerja : 0 • ‘Mixed case’ : 0 • Menggambarkan kegunaan method : +2 MN = 3
  • 94. Meaningful Name (3) • Class Tool • Class Screen Nama Method MNm Nama Method MNm main 5 DrawPixel 4 ErasePixel 4 • Class DrawingPackage EraseRegion 4 Nama Method MNm EraseAll 4 Initial 3 Refresh 4 Interact 4 ApplyDragTool 4 RedrawAll 4
  • 95. Meaningful Name (4) • Class ShapeList Nama Method MNm AddShape 4 RemoveShape 4 FirstShapeContaining 3 Select 4 UnselectAll 4 RemoveSelected 4 SetBorderOfSelected 4 SetFillOfSelected 4 DrawAll 4 Reorder 4
  • 96. Meaningful Name (5) • Class CShape Nama Method MNm Draw 4 Drag 4 SetBorder 4 SetFill 4 Select 4 Unselect 4 Selected 3 Untuk Abstract method langsung di CRect dan CCircle
  • 97. Meaningful Name (6) • Class CRect • Class CCircle Nama Method MNm Nama Method MNm Contains 4 Contains 4 Intersects 4 Intersects 4 DrawFill 4 DrawFill 4 DrawShape 4 DrawShape 4 DrawHandle 4 DrawHandle 4 OnResizeHandle 3 OnResizeHandle 3 Resize 4 Resize 4 Move 4 Move 4
  • 98. Meaningful Name (7) • Class CTextBox Nama Method MNm DrawFill 4
  • 99. MN PC Parameter Meaningful Name Complexity INPUT PARAMETER
  • 100. Meaningful Name • Tingkat kejelasan kegunaan parameter dilihat dari Definisi namanya • MN semakin besar  semakin reusable Hubungan • Tergantung asumsi & kebutuhan pihak developer, Perhitungan juga bahasa yang digunakan Acceptable •4–5 range
  • 101. Meaningful Name (2) • Asumsi yang kami gunakan: ▫ Dalam Bahasa Inggris : +1 ▫ ‘Mixed case’ : +1 ▫ Menggambarkan kegunaan parameter : +3
  • 102. Meaningful Name (3) • Method Drag pada Class CShape Penilaian : 1. startx • Dalam Bahasa Inggris : +1 • ‘Mixed case’ : +1 • Menggambarkan kegunaan parameter: +3 • MN = 5 2. starty, endx, dan endy • idem
  • 103. Meaningful Name (4) • Class Tool Nama Method Parameter MNp main argv 5 • Class DrawingPackage Nama Method Parameter MNp ApplyDragTool tool 5 startx 5 starty 5 endx 5 endy 5
  • 104. Meaningful Name (5) • Class Screen Nama Method Parameter MNp DrawPixel x 5 y 5 value 5 ErasePixel x 5 y 5 EraseRegion x1 5 y1 5 x2 5 y2 5
  • 105. Meaningful Name (6) • Class ShapeList Nama Method Parameter MNp AddShape shape 5 RemoveShape shape 5 FirstShapeContaining px 5 py 5 Select top 5 left 5 bottom 5 right 5 SetBorderOfSelected border 5 SetFillOfSelected fill 5
  • 106. Meaningful Name (7) • Class CShape Nama Method Parameter MNp Drag startx 5 starty 5 endx 5 endy 5 SetBorder border 5 SetFill fill 5 Untuk Abstract method langsung di CRect dan CCircle
  • 107. Meaningful Name (8) • Class CRect Nama Method Parameter MNp Contains px 5 py 5 Intersects dtop 5 dleft 5 dbottom 5 dright 5 OnResizeHandle px 5 py 5 Resize dx 5 dy 5 Move dx 5 dy 5
  • 108. Meaningful Name (8) • Class CCircle Nama Method Parameter MNp Contains px 5 py 5 Intersects dtop 5 dleft 5 dbottom 5 dright 5 OnResizeHandle px 5 py 5 Resize dx 5 dy 5 Move dx 5 dy 5
  • 109. Parameter Complexity • Kompleksitas struktur data dari parameter Definisi • PC semakin kecil  semakin reusable Hubungan • Jumlah sub-tipe parameter Perhitungan Acceptable •1 range
  • 110. Parameter Complexity (2) • Method AddShape ada ShapeList Perhitungan: Cshape memiliki 3 subtipe, yaitu: • CRect • CCircle • CTextBox Sehingga untuk shape, PC = 3
  • 111. Parameter Complexity (4) • Class Tool Nama Method Nama Parameter Tipe Parameter PC main argv String[] 0 • Class DrawingPackage Nama Method Nama Parameter Tipe Parameter PC ApplyDragTool tool char 0 startx int 0 starty int 0 endx int 0 endy int 0
  • 112. Parameter Complexity (4) • Class Screen Nama Method Nama Parameter Tipe Parameter PC DrawPixel x int 0 y int 0 value char 0 ErasePixel x int 0 y int 0 EraseRegion x1 int 0 y1 int 0 x2 int 0 y2 int 0
  • 113. Parameter Complexity (5) • Class ShapeList Nama Method Nama Parameter Tipe Parameter PC AddShape shape CShape 3 RemoveShape shape CShape 3 FirstShapeContaining px int 0 py int 0 Select top int 0 left int 0 bottom int 0 right int 0 SetBorderOfSelected border char 0 SetFillOfSelected fill char 0
  • 114. Parameter Complexity (6) • Class CShape Nama Method Nama Parameter Tipe Parameter PC Drag startx int 0 starty int 0 endx int 0 endy int 0 SetBorder border char 0 SetFill fill char 0 Untuk Abstract method langsung di CRect dan CCircle
  • 115. Parameter Complexity (7) • Class CRect Nama Method Nama Parameter Tipe Parameter PC Contains px int 0 py int 0 Intersects dtop int 0 dleft int 0 dbottom int 0 dright int 0 OnResizeHandle px int 0 py int 0 Resize dx int 0 dy int 0 Move dx int 0 dy int 0
  • 116. Parameter Complexity (9) • Class CCircle Nama Method Nama Parameter Tipe Parameter PC Contains px int 0 py int 0 Intersects dtop int 0 dleft int 0 dbottom int 0 dright int 0 OnResizeHandle px int 0 py int 0 Resize dx int 0 dy int 0 Move dx int 0 dy int 0
  • 117. Perhitungan Rm • Kelas Rm Tool 3.67 DrawingPackage 2.57 Screen 10 ShapeList 4.72 CShape 7.89 CRect 6.44 CCircle 7.38 CTextBox 5

Hinweis der Redaktion

  1. Semakinkecil CBO suatukelas semakinindependenkelastersebut  semakinmudahkelastersebut di-reusepadaaplikasi lain.Menggunakan method/atributkelas lain
  2. Semakinkecil DIT suatukelas semakindalamkelastersebutpadahierarki  semakinbanyakmethod yang di-inherit olehkelastersebut semakinkompleksuntukmemprediksibehaviornya semakinsulitkelastersebut di-reusepadaaplikasi lain.Deeper trees greater design complexity
  3. Hanya yangtipeatributnyaCshapesaja
  4. Aturanmenghitung : (tapijadinyabanyak….)Jumlahtanda “ ; ” yang bukanpadavariabel temporalnbuahSystem.outdianggapsebagai 1 fungsi “menulisoutput”nbuah System.in dianggapsebagai 1 fungsi “membacainput”Instansiasi / membuatobjekdihitungsebagaifungsinbuah return dihitungsebagai 1 fungsiDalam if-else dihitung 1n buahpemanggilan method ygsamadianggap 1
  5. Aturanmenghitung : (tapijadinyabanyak….)Jumlahtanda “ ; ” yang bukanpadavariabel temporalnbuahSystem.outdianggapsebagai 1 fungsi “menulisoutput”nbuah System.in dianggapsebagai 1 fungsi “membacainput”Instansiasi / membuatobjekdihitungsebagaifungsinbuah return dihitungsebagai 1 fungsiDalam if-else dihitung 1n buahpemanggilan method ygsamadianggap 1
  6. Yang lain nilai full
  7. Aturanmenghitung : (tapijadinyabanyak….)Jumlahtanda “ ; ” yang bukanpadavariabel temporalnbuahSystem.outdianggapsebagai 1 fungsi “menulisoutput”nbuah System.in dianggapsebagai 1 fungsi “membacainput”Instansiasi / membuatobjekdihitungsebagaifungsinbuah return dihitungsebagai 1 fungsiDalam if-else dihitung 1n buahpemanggilan method ygsamadianggap 1
  8. Yang lain nilai full
  9. Aturanmenghitung : (tapijadinyabanyak….)Jumlahtanda “ ; ” yang bukanpadavariabel temporalnbuahSystem.outdianggapsebagai 1 fungsi “menulisoutput”nbuah System.in dianggapsebagai 1 fungsi “membacainput”Instansiasi / membuatobjekdihitungsebagaifungsinbuah return dihitungsebagai 1 fungsiDalam if-else dihitung 1n buahpemanggilan method ygsamadianggap 1
  10. Yang lain nilai full
  11. Yang lain nilai full
  12. Sub-tipe : sub-class
  13. Hanya yangparameternyaCshapesaja
  14. Yang lain nilai full
  15. Yang lain nilai full