SlideShare a Scribd company logo
1 of 33
Download to read offline
A Domain Analysis to Specify Design
Defects and Generate Detection Algorithms


      Naouel Moha, Yann-Gaël Guéhéneuc,
    Anne-Françoise Le Meur, Laurence Duchien


              Ptidej Team, GEODES, Université de Montréal, Canada
      LIFL, INRIA Lille - Nord Europe / ADAM Team, Université de Lille, France


                                  FASE’08
                          29 March - 6 April, 2008
Context




Moha ©    A Domain Analysis to Specify Design Defects and Generate Detection Algorithms   2
Context




Moha ©    A Domain Analysis to Specify Design Defects and Generate Detection Algorithms   3
What Kind of Defects ?
    Design Patterns are “good” solutions to recurring design problems

    Design Defects (DDs)
         are “bad” solutions to recurring problems
         2 categories:
            High-level (global) problems: antipatterns [Brown 98]
            Low-level (local) problems: code smells* [Fowler 99]

    “ deviations from specifications or expectations which might lead to
≠
    failures in operation ”


    * Some code smells can be considered as high-level DDs


Moha ©              A Domain Analysis to Specify Design Defects and Generate Detection Algorithms   4
What Kind of Defects ?
  2 examples of high-level DDs [Brown 98]

                            Blob (God Class)
                            “ Procedural-style design leads to one object with a
                            lion’s share of the responsibilities while most other
                            objects only hold data or execute simple processes ”


                                 Large controller class

                                 Many fields and methods with a low cohesion*

                                 Dependent on the data stored in associated
                                 data classes

                                    *How closely the methods are related to the instance
                                     variables in the class.
Moha ©        A Domain Analysis to Specify Design Defects and Generate Detection Algorithms   5
What Kind of Defects ?
  2 examples of high-level DDs [Brown 98]

                            Spaghetti Code
                            “ Ad hoc software structure makes it difficult to extend
                            and optimize code. ”


                                 Procedural thinking in OO programming

                                 Lack of structure : no inheritance, no reuse, no
                                 polymorphism

                                 Long methods process oriented with no
                                 parameters and low cohesion

                                 Classes with procedural names

                                 Use of global variables for processing
Moha ©        A Domain Analysis to Specify Design Defects and Generate Detection Algorithms   6
Method DECOR




                               Specification




                                                   Processing




                                                                                             Validation
                                                                      Detection
         Analysis
         Domain




Moha ©       A Domain Analysis to Specify Design Defects and Generate Detection Algorithms                7
Method DECOR




                               Specification




                                                   Processing




                                                                                             Validation
                                                                      Detection
         Analysis
         Domain




Moha ©       A Domain Analysis to Specify Design Defects and Generate Detection Algorithms                8
Method DECOR




                                       Specification




                                                           Processing




                                                                                                     Validation
                                                                              Detection
                 Analysis
                 Domain




     Contributions
         Domain analysis of DDs and domain-specific language

         Explicit process for the specifications

         Validation : first study on both precision and recall

Moha ©               A Domain Analysis to Specify Design Defects and Generate Detection Algorithms                9
Method DECOR




                               Specification




                                                   Processing




                                                                                             Validation
                                                                      Detection
         Analysis
         Domain




Moha ©       A Domain Analysis to Specify Design Defects and Generate Detection Algorithms                10
DECOR Method




Domain Analysis
                                                                               On all defects                                                     On each defect                                                   On each system
                                                                                                                                                                                       Source code                      Source code
                                                                                                      1                                       2                                  3                                 4                                 5




                                                                                                                              Specification
                                                                                                                                                                                       of the system                    of the system




                                                                                                                                                                    Processing




                                                                                                                                                                                                                                        Validation
                                                                                                           Vocabulary




                                                                                                                                                                                                       Detection
                                                                                                Analysis
                                                                                                Domain
                                                                   Text-based descriptions                                                         Specifications                     Operational                      Suspicious                         Classes having
                                                                      of design defects                                                                                              specifications                     classes                           design defects
                                                                                                           Taxonomy
                                                                     Brown et al. (1998)
                                                                      Demeyer (2002)
                                                                       Dudney (2003)
                                                                                                                                                                                                 Marinescu (2004)           Marinescu (2004)
                                                                       Fowler (1999)                                    Marinescu (2004)
                                                                                                                                                                                                 Alikacem (2006)             Munro (2005)
                                                                        Riel (1996)                                      Munro (2005)
                                                                                                                                                                                        Travassos : manual detection (1999)
                                                                      Webster (1995)                                    Alikacem (2006)
                                                                                                                                                                                        Tools: SmallLint, PMD, CROCOPAT




                                                          The Spaghetti Code is an
                                                        antipattern that is characteristic
             Chapter 1                                  of procedural thinking in object-
                                                        oriented programming. Spaghetti
                                                        Code is revealed by classes with
     Descriptions of antipatterns                       no structure, declaring long
                                                        methods with no parameters,
                                                        and utilising global variables for
                                                        processing. Names of classes
                                                        and methods may suggest
                                                        procedural          programming.
                                                        Spaghetti Code does not exploit
                                                        and prevents the use of object-
                                                        orientation          mechanisms,
                                                        polymorphism and inheritance.



Moha ©           A Domain Analysis to Specify Design Defects and Generate Detection Algorithms                                                                                                                                                       11
DECOR Method




Domain Analysis
                                                                                 On all defects                                                     On each defect                                                   On each system
                                                                                                                                                                                         Source code                      Source code
                                                                                                        1                                       2                                  3                                 4                                 5




                                                                                                                                Specification
                                                                                                                                                                                         of the system                    of the system




                                                                                                                                                                      Processing




                                                                                                                                                                                                                                          Validation
                                                                                                             Vocabulary




                                                                                                                                                                                                         Detection
                                                                                                  Analysis
                                                                                                  Domain
                                                                     Text-based descriptions                                                         Specifications                     Operational                      Suspicious                         Classes having
                                                                        of design defects                                                                                              specifications                     classes                           design defects
                                                                                                             Taxonomy
                                                                       Brown et al. (1998)
                                                                        Demeyer (2002)
                                                                         Dudney (2003)
                                                                                                                                                                                                   Marinescu (2004)           Marinescu (2004)
                                                                         Fowler (1999)                                    Marinescu (2004)
                                                                                                                                                                                                   Alikacem (2006)             Munro (2005)
                                                                          Riel (1996)                                      Munro (2005)
                                                                                                                                                                                          Travassos : manual detection (1999)
                                                                        Webster (1995)                                    Alikacem (2006)
                                                                                                                                                                                          Tools: SmallLint, PMD, CROCOPAT




                                                            The Spaghetti Code is an
                                                          antipattern that is characteristic
               Chapter 1                                  of procedural thinking in object-
                                                          oriented programming. Spaghetti
                                                          Code is revealed by classes with
     Descriptions of antipatterns                         no structure, declaring long
                                                          methods with no parameters,
                                                          and utilising global variables for
         Identification of Key Concepts                   processing. Names of classes
                                                          and methods may suggest
                                                          procedural          programming.
                                                          Spaghetti Code does not exploit
                                                          and prevents the use of object-
                                                          orientation          mechanisms,
                                                          polymorphism and inheritance.



Moha ©             A Domain Analysis to Specify Design Defects and Generate Detection Algorithms                                                                                                                                                       12
DECOR Method




Domain Analysis
                                                                       On all defects                                                     On each defect                                                   On each system
                                                                                                                                                                               Source code                      Source code
                                                                                              1                                       2                                  3                                 4                                 5




                                                                                                                      Specification
                                                                                                                                                                               of the system                    of the system




                                                                                                                                                            Processing




                                                                                                                                                                                                                                Validation
                                                                                                   Vocabulary




                                                                                                                                                                                               Detection
                                                                                        Analysis
                                                                                        Domain
                                                           Text-based descriptions                                                         Specifications                     Operational                      Suspicious                         Classes having
                                                              of design defects                                                                                              specifications                     classes                           design defects
                                                                                                   Taxonomy
                                                             Brown et al. (1998)
                                                              Demeyer (2002)
                                                               Dudney (2003)
                                                                                                                                                                                         Marinescu (2004)           Marinescu (2004)
                                                               Fowler (1999)                                    Marinescu (2004)
                                                                                                                                                                                         Alikacem (2006)             Munro (2005)
                                                                Riel (1996)                                      Munro (2005)
                                                                                                                                                                                Travassos : manual detection (1999)
                                                              Webster (1995)                                    Alikacem (2006)
                                                                                                                                                                                Tools: SmallLint, PMD, CROCOPAT




Moha ©   A Domain Analysis to Specify Design Defects and Generate Detection Algorithms                                                                                                                                                       13
DECOR Method




Domain Analysis
                                                                       On all defects                                                     On each defect                                                   On each system
                                                                                                                                                                               Source code                      Source code
                                                                                              1                                       2                                  3                                 4                                 5




                                                                                                                      Specification
                                                                                                                                                                               of the system                    of the system




                                                                                                                                                            Processing




                                                                                                                                                                                                                                Validation
                                                                                                   Vocabulary




                                                                                                                                                                                               Detection
                                                                                        Analysis
                                                                                        Domain
                                                           Text-based descriptions                                                         Specifications                     Operational                      Suspicious                         Classes having
                                                              of design defects                                                                                              specifications                     classes                           design defects
                                                                                                   Taxonomy
                                                             Brown et al. (1998)
                                                              Demeyer (2002)
                                                               Dudney (2003)
                                                                                                                                                                                         Marinescu (2004)           Marinescu (2004)
                                                               Fowler (1999)                                    Marinescu (2004)
                                                                                                                                                                                         Alikacem (2006)             Munro (2005)
                                                                Riel (1996)                                      Munro (2005)
                                                                                                                                                                                Travassos : manual detection (1999)
                                                              Webster (1995)                                    Alikacem (2006)
                                                                                                                                                                                Tools: SmallLint, PMD, CROCOPAT




Moha ©   A Domain Analysis to Specify Design Defects and Generate Detection Algorithms                                                                                                                                                       14
Method DECOR




                               Specification




                                                   Processing




                                                                                             Validation
                                                                      Detection
         Analysis
         Domain




Moha ©       A Domain Analysis to Specify Design Defects and Generate Detection Algorithms                15
DECOR Method




Specifications
                                                                                     On all defects                                                     On each defect                                                   On each system
                                                                                                                                                                                             Source code                      Source code
                                                                                                            1                                       2                                  3                                 4                                 5




                                                                                                                                    Specification
                                                                                                                                                                                             of the system                    of the system




                                                                                                                                                                          Processing




                                                                                                                                                                                                                                              Validation
                                                                                                                 Vocabulary




                                                                                                                                                                                                             Detection
                                                                                                      Analysis
                                                                                                      Domain
                                                                         Text-based descriptions                                                         Specifications                     Operational                      Suspicious                         Classes having
                                                                            of design defects                                                                                              specifications                     classes                           design defects
                                                                                                                 Taxonomy
                                                                           Brown et al. (1998)
                                                                            Demeyer (2002)
                                                                             Dudney (2003)
                                                                                                                                                                                                       Marinescu (2004)           Marinescu (2004)
                                                                             Fowler (1999)                                    Marinescu (2004)
                                                                                                                                                                                                       Alikacem (2006)             Munro (2005)
                                                                              Riel (1996)                                      Munro (2005)
                                                                                                                                                                                              Travassos : manual detection (1999)
                                                                            Webster (1995)                                    Alikacem (2006)
                                                                                                                                                                                              Tools: SmallLint, PMD, CROCOPAT




SADSL (Software Architectural Defect Specification Language)
         Language based on a meta-model for specifying DDs


  CODESMELL   define   LongMethod            as    METRIC     LOC_METHOD with                                     VERY HIGH and 10.0 ;

  CODESMELL   define   NoParameter           as    METRIC     NMNOPARAM                   with                    VERY HIGH and 5.0 ;
  CODESMELL   define   NoInheritance         as    METRIC     DIT                         with                    1 and 0.0 ;
  CODESMELL   define   NoPolymorphism as           STRUC      NO_POLYMORPHISM ;

  CODESMELL   define   ProceduralName as           LEXIC      CLASS_NAME with                                     (Make, Create, Exec) ;

  CODESMELL   define   GlobalVariable as           STRUC      USE_GLOBAL_VARIABLE ;


  ANTIPATTERN define SpaghettiCode           as {
         ((LongMethod INTER NoParameter) INTER (NoInheritance UNION NoPolymorphism))

     INTER
         (ProceduralName UNION UseGlobalVariable) } ;




Moha ©                 A Domain Analysis to Specify Design Defects and Generate Detection Algorithms                                                                                                                                                       16
DECOR Method




Specifications
                                                                                     On all defects                                                     On each defect                                                   On each system
                                                                                                                                                                                             Source code                      Source code
                                                                                                            1                                       2                                  3                                 4                                 5




                                                                                                                                    Specification
                                                                                                                                                                                             of the system                    of the system




                                                                                                                                                                          Processing




                                                                                                                                                                                                                                              Validation
                                                                                                                 Vocabulary




                                                                                                                                                                                                             Detection
                                                                                                      Analysis
                                                                                                      Domain
                                                                         Text-based descriptions                                                         Specifications                     Operational                      Suspicious                         Classes having
                                                                            of design defects                                                                                              specifications                     classes                           design defects
                                                                                                                 Taxonomy
                                                                           Brown et al. (1998)
                                                                            Demeyer (2002)
                                                                             Dudney (2003)
                                                                                                                                                                                                       Marinescu (2004)           Marinescu (2004)
                                                                             Fowler (1999)                                    Marinescu (2004)
                                                                                                                                                                                                       Alikacem (2006)             Munro (2005)
                                                                              Riel (1996)                                      Munro (2005)
                                                                                                                                                                                              Travassos : manual detection (1999)
                                                                            Webster (1995)                                    Alikacem (2006)
                                                                                                                                                                                              Tools: SmallLint, PMD, CROCOPAT




SADSL (Software Architectural Defect Specification Language)
         Language based on a meta-model for specifying DDs


  CODESMELL   define   LongMethod            as    METRIC     LOC_METHOD with                                     VERY HIGH and 10.0 ;

  CODESMELL   define   NoParameter           as    METRIC     NMNOPARAM                   with                    VERY HIGH and 5.0 ;
  CODESMELL   define   NoInheritance         as    METRIC     DIT                         with                    1 and 0.0 ;
  CODESMELL   define   NoPolymorphism as            STRUC     NO_POLYMORPHISM ;
  CODESMELL   define   ProceduralName as            LEXIC     CLASS_NAME with                                     (Make, Create, Exec) ;
  CODESMELL   define   GlobalVariable as           STRUC      USE_GLOBAL_VARIABLE ;



  ANTIPATTERN define SpaghettiCode           as {
         ((LongMethod INTER NoParameter) INTER (NoInheritance UNION NoPolymorphism))

     INTER
         (ProceduralName UNION UseGlobalVariable) } ;




Moha ©                 A Domain Analysis to Specify Design Defects and Generate Detection Algorithms                                                                                                                                                       17
DECOR Method




 Specifications
                                                                              On all defects                                                     On each defect                                                   On each system
                                                                                                                                                                                      Source code                      Source code
                                                                                                     1                                       2                                  3                                 4                                 5




                                                                                                                             Specification
                                                                                                                                                                                      of the system                    of the system




                                                                                                                                                                   Processing




                                                                                                                                                                                                                                       Validation
                                                                                                          Vocabulary




                                                                                                                                                                                                      Detection
                                                                                               Analysis
                                                                                               Domain
                                                                  Text-based descriptions                                                         Specifications                     Operational                      Suspicious                         Classes having
                                                                     of design defects                                                                                              specifications                     classes                           design defects
                                                                                                          Taxonomy
                                                                    Brown et al. (1998)
                                                                     Demeyer (2002)
                                                                      Dudney (2003)
                                                                                                                                                                                                Marinescu (2004)           Marinescu (2004)
                                                                      Fowler (1999)                                    Marinescu (2004)
                                                                                                                                                                                                Alikacem (2006)             Munro (2005)
                                                                       Riel (1996)                                      Munro (2005)
                                                                                                                                                                                       Travassos : manual detection (1999)
                                                                     Webster (1995)                                    Alikacem (2006)
                                                                                                                                                                                       Tools: SmallLint, PMD, CROCOPAT




Meta-model SADDL (Software Architectural Defect Definition Language)




Moha ©          A Domain Analysis to Specify Design Defects and Generate Detection Algorithms                                                                                                                                                       18
Method DECOR




                               Specification




                                                   Processing




                                                                                             Validation
                                                                      Detection
         Analysis
         Domain




Moha ©       A Domain Analysis to Specify Design Defects and Generate Detection Algorithms                19
Method DECOR




                               Specification




                                                 Generation




                                                                                             Validation
                                                 Algorithm




                                                                      Detection
         Analysis
         Domain




Moha ©       A Domain Analysis to Specify Design Defects and Generate Detection Algorithms                20
DECOR Method




Algorithm Generation
                                                                       On all defects                                                     On each defect                                                   On each system
                                                                                                                                                                               Source code                      Source code
                                                                                              1                                       2                                  3                                 4                                 5




                                                                                                                      Specification
                                                                                                                                                                               of the system                    of the system




                                                                                                                                                            Processing




                                                                                                                                                                                                                                Validation
                                                                                                   Vocabulary




                                                                                                                                                                                               Detection
                                                                                        Analysis
                                                                                        Domain
                                                           Text-based descriptions                                                         Specifications                     Operational                      Suspicious                         Classes having
                                                              of design defects                                                                                              specifications                     classes                           design defects
                                                                                                   Taxonomy
                                                             Brown et al. (1998)
                                                              Demeyer (2002)
                                                               Dudney (2003)
                                                                                                                                                                                         Marinescu (2004)           Marinescu (2004)
                                                               Fowler (1999)                                    Marinescu (2004)
                                                                                                                                                                                         Alikacem (2006)             Munro (2005)
                                                                Riel (1996)                                      Munro (2005)
                                                                                                                                                                                Travassos : manual detection (1999)
                                                              Webster (1995)                                    Alikacem (2006)
                                                                                                                                                                                Tools: SmallLint, PMD, CROCOPAT




Moha ©   A Domain Analysis to Specify Design Defects and Generate Detection Algorithms                                                                                                                                                       21
DECOR Method




Algorithm Generation
                                                                       On all defects                                                     On each defect                                                   On each system
                                                                                                                                                                               Source code                      Source code
                                                                                              1                                       2                                  3                                 4                                 5




                                                                                                                      Specification
                                                                                                                                                                               of the system                    of the system




                                                                                                                                                            Processing




                                                                                                                                                                                                                                Validation
                                                                                                   Vocabulary




                                                                                                                                                                                               Detection
                                                                                        Analysis
                                                                                        Domain
                                                           Text-based descriptions                                                         Specifications                     Operational                      Suspicious                         Classes having
                                                              of design defects                                                                                              specifications                     classes                           design defects
                                                                                                   Taxonomy
                                                             Brown et al. (1998)
                                                              Demeyer (2002)
                                                               Dudney (2003)
                                                                                                                                                                                         Marinescu (2004)           Marinescu (2004)
                                                               Fowler (1999)                                    Marinescu (2004)
                                                                                                                                                                                         Alikacem (2006)             Munro (2005)
                                                                Riel (1996)                                      Munro (2005)
                                                                                                                                                                                Travassos : manual detection (1999)
                                                              Webster (1995)                                    Alikacem (2006)
                                                                                                                                                                                Tools: SmallLint, PMD, CROCOPAT




Moha ©   A Domain Analysis to Specify Design Defects and Generate Detection Algorithms                                                                                                                                                       22
DECOR Method




Algorithm Generation
                                                                       On all defects                                                     On each defect                                                   On each system
                                                                                                                                                                               Source code                      Source code
                                                                                              1                                       2                                  3                                 4                                 5




                                                                                                                      Specification
                                                                                                                                                                               of the system                    of the system




                                                                                                                                                            Processing




                                                                                                                                                                                                                                Validation
                                                                                                   Vocabulary




                                                                                                                                                                                               Detection
                                                                                        Analysis
                                                                                        Domain
                                                           Text-based descriptions                                                         Specifications                     Operational                      Suspicious                         Classes having
                                                              of design defects                                                                                              specifications                     classes                           design defects
                                                                                                   Taxonomy
                                                             Brown et al. (1998)
                                                              Demeyer (2002)
                                                               Dudney (2003)
                                                                                                                                                                                         Marinescu (2004)           Marinescu (2004)
                                                               Fowler (1999)                                    Marinescu (2004)
                                                                                                                                                                                         Alikacem (2006)             Munro (2005)
                                                                Riel (1996)                                      Munro (2005)
                                                                                                                                                                                Travassos : manual detection (1999)
                                                              Webster (1995)                                    Alikacem (2006)
                                                                                                                                                                                Tools: SmallLint, PMD, CROCOPAT




         Consistency and domain-specific analyses
           - Verify that specifications are not inconsistent, redundant,
             or incomplete

          - Ex: 2 rules with same names but different properties
                2 rules with different names but identical properties



Moha ©   A Domain Analysis to Specify Design Defects and Generate Detection Algorithms                                                                                                                                                       23
DECOR Method




Algorithm Generation
                                                                                   On all defects                                                     On each defect                                                   On each system
                                                                                                                                                                                           Source code                      Source code
                                                                                                          1                                       2                                  3                                 4                                 5




                                                                                                                                  Specification
                                                                                                                                                                                           of the system                    of the system




                                                                                                                                                                        Processing




                                                                                                                                                                                                                                            Validation
                                                                                                               Vocabulary




                                                                                                                                                                                                           Detection
                                                                                                    Analysis
                                                                                                    Domain
                                                                       Text-based descriptions                                                         Specifications                     Operational                      Suspicious                         Classes having
                                                                          of design defects                                                                                              specifications                     classes                           design defects
                                                                                                               Taxonomy
                                                                         Brown et al. (1998)
                                                                          Demeyer (2002)
                                                                           Dudney (2003)
                                                                                                                                                                                                     Marinescu (2004)           Marinescu (2004)
                                                                           Fowler (1999)                                    Marinescu (2004)
                                                                                                                                                                                                     Alikacem (2006)             Munro (2005)
                                                                            Riel (1996)                                      Munro (2005)
                                                                                                                                                                                            Travassos : manual detection (1999)
                                                                          Webster (1995)                                    Alikacem (2006)
                                                                                                                                                                                            Tools: SmallLint, PMD, CROCOPAT




Complexity : O((c+op) X n)                   SAD Framework
   c : number of properties                  -        Meta-model to represent OO programs
   op : number of operators                  -        Repository of metrics
   n : number of classes
                                             -        Services to analyse structural relationships
                                             -        Services to perform structural and lexical analyses




Moha ©               A Domain Analysis to Specify Design Defects and Generate Detection Algorithms                                                                                                                                                       24
DECOR Method




Algorithm Generation
                                                                             On all defects                                                     On each defect                                                   On each system
                                                                                                                                                                                     Source code                      Source code
                                                                                                    1                                       2                                  3                                 4                                 5




                                                                                                                            Specification
                                                                                                                                                                                     of the system                    of the system




                                                                                                                                                                  Processing




                                                                                                                                                                                                                                      Validation
                                                                                                         Vocabulary




                                                                                                                                                                                                     Detection
                                                                                              Analysis
                                                                                              Domain
                                                                 Text-based descriptions                                                         Specifications                     Operational                      Suspicious                         Classes having
                                                                    of design defects                                                                                              specifications                     classes                           design defects
                                                                                                         Taxonomy
                                                                   Brown et al. (1998)
                                                                    Demeyer (2002)
                                                                     Dudney (2003)
                                                                                                                                                                                               Marinescu (2004)           Marinescu (2004)
                                                                     Fowler (1999)                                    Marinescu (2004)
                                                                                                                                                                                               Alikacem (2006)             Munro (2005)
                                                                      Riel (1996)                                      Munro (2005)
                                                                                                                                                                                      Travassos : manual detection (1999)
                                                                    Webster (1995)                                    Alikacem (2006)
                                                                                                                                                                                      Tools: SmallLint, PMD, CROCOPAT




                                                     1 public class <CODESMELL>Detection
                                                     2    extends CodeSmellDetection
                                                     3    implements ICodeSmellDetection {
                                                     4    public Set performDetection() {
                                                     5      IClass c = iteratorOnClasses.next();
                                                     6      LOCofSetOfClasses.add(
                                                     7      Metrics.compute(<METRIC>, c));
                                                     8      ...
                                                     9      BoxPlot boxPlot = new BoxPlot(
                                                     10       <METRIC>ofSetOfClasses, <FUZZINESS>);
                                                     11     Map setOfOutliers =
                                                     12       boxPlot.<ORDINAL_VALUE>();
                                                     13     ...
                                                     14     suspiciousCodeSmells.add( new CodeSmell(
                                                     15       <CODESMELL>, setOfOutliers));
                                                     16     ...
                                                     17     return suspiciousCodeSmells;
                                                     18 }


         Visitor                                                          Template




Moha ©         A Domain Analysis to Specify Design Defects and Generate Detection Algorithms                                                                                                                                                       25
DECOR Method




Algorithm Generation
                                                                             On all defects                                                     On each defect                                                   On each system
                                                                                                                                                                                     Source code                      Source code
                                                                                                    1                                       2                                  3                                 4                                 5




                                                                                                                            Specification
                                                                                                                                                                                     of the system                    of the system




                                                                                                                                                                  Processing




                                                                                                                                                                                                                                      Validation
                                                                                                         Vocabulary




                                                                                                                                                                                                     Detection
                                                                                              Analysis
                                                                                              Domain
                                                                 Text-based descriptions                                                         Specifications                     Operational                      Suspicious                         Classes having
                                                                    of design defects                                                                                              specifications                     classes                           design defects
                                                                                                         Taxonomy
                                                                   Brown et al. (1998)
                                                                    Demeyer (2002)
                                                                     Dudney (2003)
                                                                                                                                                                                               Marinescu (2004)           Marinescu (2004)
                                                                     Fowler (1999)                                    Marinescu (2004)
                                                                                                                                                                                               Alikacem (2006)             Munro (2005)
                                                                      Riel (1996)                                      Munro (2005)
                                                                                                                                                                                      Travassos : manual detection (1999)
                                                                    Webster (1995)                                    Alikacem (2006)
                                                                                                                                                                                      Tools: SmallLint, PMD, CROCOPAT




         Visitor                                                 Generated Code




Moha ©         A Domain Analysis to Specify Design Defects and Generate Detection Algorithms                                                                                                                                                       26
Method DECOR




                               Specification




                                                   Processing




                                                                                             Validation
                                                                      Detection
         Analysis
         Domain




Moha ©       A Domain Analysis to Specify Design Defects and Generate Detection Algorithms                27
Method DECOR




                               Specification




                                                   Processing




                                                                                             Validation
                                                                      Detection
         Analysis
         Domain




Moha ©       A Domain Analysis to Specify Design Defects and Generate Detection Algorithms                28
DECOR Method




 Experiments
                                                                                   On all defects                                                     On each defect                                                   On each system
                                                                                                                                                                                           Source code                      Source code
                                                                                                          1                                       2                                  3                                 4                                 5




                                                                                                                                  Specification
                                                                                                                                                                                           of the system                    of the system




                                                                                                                                                                        Processing




                                                                                                                                                                                                                                            Validation
                                                                                                               Vocabulary




                                                                                                                                                                                                           Detection
                                                                                                    Analysis
                                                                                                    Domain
                                                                       Text-based descriptions                                                         Specifications                     Operational                      Suspicious                         Classes having
                                                                          of design defects                                                                                              specifications                     classes                           design defects
                                                                                                               Taxonomy
                                                                         Brown et al. (1998)
                                                                          Demeyer (2002)
                                                                           Dudney (2003)
                                                                                                                                                                                                     Marinescu (2004)           Marinescu (2004)
                                                                           Fowler (1999)                                    Marinescu (2004)
                                                                                                                                                                                                     Alikacem (2006)             Munro (2005)
                                                                            Riel (1996)                                      Munro (2005)
                                                                                                                                                                                            Travassos : manual detection (1999)
                                                                          Webster (1995)                                    Alikacem (2006)
                                                                                                                                                                                            Tools: SmallLint, PMD, CROCOPAT




Goal : Validate the generated algorithms in terms of precision and recall
Xerces: 71,217 LOC, 513 classes and 162 interfaces

                         Nb of          Existing            Detected                                                                                                                                            Detection
         Defects                                                                           Precision                                                         Recall
                        classes         Defects             Defects                                                                                                                                               Time

Blob                                   39    (7,6%)        44    (8,6%)                          88,6%                                                         100%                                                          2,45s

Functional Decomp.                     15    (2,9%)        29    (5,6%)                          51,7%                                                         100%                                                          0,91s
                           513
Spaghetti Code                         46    (9,0%)        76 (14,8%)                            60,5%                                                         100%                                                          0,23s

Swiss Army Knife                       23    (4,5%)        56 (10,9%)                            41,1%                                                         100%                                                          0,08s




Moha ©               A Domain Analysis to Specify Design Defects and Generate Detection Algorithms                                                                                                                                                       29
Demonstration




Moha ©   A Domain Analysis to Specify Design Defects and Generate Detection Algorithms   30
Conclusion
    Method DECOR
    Automate the generation of detection algorithms from specifications
    written using a domain-specific language

    Contributions
         The domain-specific language defined from a domain analysis

         Explicit process for the generation of detection algorithms

         Validation in terms of precision and recall

    Future Work
         Experiments on other systems and defects

         Comparison with existing approaches

         Correction of defects (in progress)
Moha ©             A Domain Analysis to Specify Design Defects and Generate Detection Algorithms   31
Questions
         Contact: mohanaou@iro.umontreal.ca
                  http://www-etud.iro.umontreal.ca/~mohanaou




         Thanks for your attention !

Moha ©                A Domain Analysis to Specify Design Defects and Generate Detection Algorithms   32
DECOR Method




Algorithm Generation
                                                                              On all defects                                                     On each defect                                                   On each system
                                                                                                                                                                                      Source code                      Source code
                                                                                                     1                                       2                                  3                                 4                                 5




                                                                                                                             Specification
                                                                                                                                                                                      of the system                    of the system




                                                                                                                                                                   Processing




                                                                                                                                                                                                                                       Validation
                                                                                                          Vocabulary




                                                                                                                                                                                                      Detection
                                                                                               Analysis
                                                                                               Domain
                                                                  Text-based descriptions                                                         Specifications                     Operational                      Suspicious                         Classes having
                                                                     of design defects                                                                                              specifications                     classes                           design defects
                                                                                                          Taxonomy
                                                                    Brown et al. (1998)
                                                                     Demeyer (2002)
                                                                      Dudney (2003)
                                                                                                                                                                                                Marinescu (2004)           Marinescu (2004)
                                                                      Fowler (1999)                                    Marinescu (2004)
                                                                                                                                                                                                Alikacem (2006)             Munro (2005)
                                                                       Riel (1996)                                      Munro (2005)
                                                                                                                                                                                       Travassos : manual detection (1999)
                                                                     Webster (1995)                                    Alikacem (2006)
                                                                                                                                                                                       Tools: SmallLint, PMD, CROCOPAT




  Box-plot for metrics with ordinal values




Moha ©          A Domain Analysis to Specify Design Defects and Generate Detection Algorithms                                                                                                                                                       33

More Related Content

Similar to FASE08.ppt

Cascon06 tooldemo.ppt
Cascon06 tooldemo.pptCascon06 tooldemo.ppt
Cascon06 tooldemo.pptPtidej Team
 
Quick fix generation for DSMLs
Quick fix generation for DSMLsQuick fix generation for DSMLs
Quick fix generation for DSMLsÁbel Hegedüs
 
Cross-project defect prediction
Cross-project defect predictionCross-project defect prediction
Cross-project defect predictionThomas Zimmermann
 
Blackboard DevCon 2012 - Ensuring Code Quality
Blackboard DevCon 2012 - Ensuring Code QualityBlackboard DevCon 2012 - Ensuring Code Quality
Blackboard DevCon 2012 - Ensuring Code QualityNoriaki Tatsumi
 
Investor's Presentation
Investor's PresentationInvestor's Presentation
Investor's PresentationEltechs
 
Monitoreo y análisis de aplicaciones "Multi-Tier"
Monitoreo y análisis de aplicaciones "Multi-Tier"Monitoreo y análisis de aplicaciones "Multi-Tier"
Monitoreo y análisis de aplicaciones "Multi-Tier"GeneXus
 
The Next Static Code Analysis Tool - Today and Tomorrow
The Next Static Code Analysis Tool - Today and TomorrowThe Next Static Code Analysis Tool - Today and Tomorrow
The Next Static Code Analysis Tool - Today and TomorrowM Firdaus Harun
 
Persistent Analytical Instrumentation Expertise
Persistent Analytical Instrumentation ExpertisePersistent Analytical Instrumentation Expertise
Persistent Analytical Instrumentation ExpertiseSebastien RATTIER
 
Preparing for the era of cloud computing: Towards a framework for selecting b...
Preparing for the era of cloud computing: Towards a framework for selecting b...Preparing for the era of cloud computing: Towards a framework for selecting b...
Preparing for the era of cloud computing: Towards a framework for selecting b...Ilia Bider
 
MoDisco EclipseCon2010
MoDisco EclipseCon2010MoDisco EclipseCon2010
MoDisco EclipseCon2010fmadiot
 
Statistical debuging for programs written in dynamic programming language ruby
Statistical debuging for programs written in dynamic programming language   rubyStatistical debuging for programs written in dynamic programming language   ruby
Statistical debuging for programs written in dynamic programming language rubyAdeel Akhter
 
STPCon fall 2012: The Testing Renaissance Has Arrived
STPCon fall 2012: The Testing Renaissance Has ArrivedSTPCon fall 2012: The Testing Renaissance Has Arrived
STPCon fall 2012: The Testing Renaissance Has ArrivedSOASTA
 

Similar to FASE08.ppt (20)

Fase08.ppt
Fase08.pptFase08.ppt
Fase08.ppt
 
Cascon06 tooldemo.ppt
Cascon06 tooldemo.pptCascon06 tooldemo.ppt
Cascon06 tooldemo.ppt
 
Ase06.ppt
Ase06.pptAse06.ppt
Ase06.ppt
 
Cascon06 tooldemo.ppt
Cascon06 tooldemo.pptCascon06 tooldemo.ppt
Cascon06 tooldemo.ppt
 
Quick fix generation for DSMLs
Quick fix generation for DSMLsQuick fix generation for DSMLs
Quick fix generation for DSMLs
 
Cross-project defect prediction
Cross-project defect predictionCross-project defect prediction
Cross-project defect prediction
 
Bonneau - Software and Systems - Spring Review 2012
Bonneau - Software and Systems - Spring Review 2012Bonneau - Software and Systems - Spring Review 2012
Bonneau - Software and Systems - Spring Review 2012
 
Blackboard DevCon 2012 - Ensuring Code Quality
Blackboard DevCon 2012 - Ensuring Code QualityBlackboard DevCon 2012 - Ensuring Code Quality
Blackboard DevCon 2012 - Ensuring Code Quality
 
Sonar En
Sonar EnSonar En
Sonar En
 
Project P
Project PProject P
Project P
 
Open source
Open sourceOpen source
Open source
 
RTF - Prasad bhatt
RTF - Prasad bhattRTF - Prasad bhatt
RTF - Prasad bhatt
 
Investor's Presentation
Investor's PresentationInvestor's Presentation
Investor's Presentation
 
Monitoreo y análisis de aplicaciones "Multi-Tier"
Monitoreo y análisis de aplicaciones "Multi-Tier"Monitoreo y análisis de aplicaciones "Multi-Tier"
Monitoreo y análisis de aplicaciones "Multi-Tier"
 
The Next Static Code Analysis Tool - Today and Tomorrow
The Next Static Code Analysis Tool - Today and TomorrowThe Next Static Code Analysis Tool - Today and Tomorrow
The Next Static Code Analysis Tool - Today and Tomorrow
 
Persistent Analytical Instrumentation Expertise
Persistent Analytical Instrumentation ExpertisePersistent Analytical Instrumentation Expertise
Persistent Analytical Instrumentation Expertise
 
Preparing for the era of cloud computing: Towards a framework for selecting b...
Preparing for the era of cloud computing: Towards a framework for selecting b...Preparing for the era of cloud computing: Towards a framework for selecting b...
Preparing for the era of cloud computing: Towards a framework for selecting b...
 
MoDisco EclipseCon2010
MoDisco EclipseCon2010MoDisco EclipseCon2010
MoDisco EclipseCon2010
 
Statistical debuging for programs written in dynamic programming language ruby
Statistical debuging for programs written in dynamic programming language   rubyStatistical debuging for programs written in dynamic programming language   ruby
Statistical debuging for programs written in dynamic programming language ruby
 
STPCon fall 2012: The Testing Renaissance Has Arrived
STPCon fall 2012: The Testing Renaissance Has ArrivedSTPCon fall 2012: The Testing Renaissance Has Arrived
STPCon fall 2012: The Testing Renaissance Has Arrived
 

More from Ptidej Team

From IoT to Software Miniaturisation
From IoT to Software MiniaturisationFrom IoT to Software Miniaturisation
From IoT to Software MiniaturisationPtidej Team
 
Presentation by Lionel Briand
Presentation by Lionel BriandPresentation by Lionel Briand
Presentation by Lionel BriandPtidej Team
 
Manel Abdellatif
Manel AbdellatifManel Abdellatif
Manel AbdellatifPtidej Team
 
Azadeh Kermansaravi
Azadeh KermansaraviAzadeh Kermansaravi
Azadeh KermansaraviPtidej Team
 
CSED - Manel Grichi
CSED - Manel GrichiCSED - Manel Grichi
CSED - Manel GrichiPtidej Team
 
Cristiano Politowski
Cristiano PolitowskiCristiano Politowski
Cristiano PolitowskiPtidej Team
 
Will io t trigger the next software crisis
Will io t trigger the next software crisisWill io t trigger the next software crisis
Will io t trigger the next software crisisPtidej Team
 
Thesis+of+laleh+eshkevari.ppt
Thesis+of+laleh+eshkevari.pptThesis+of+laleh+eshkevari.ppt
Thesis+of+laleh+eshkevari.pptPtidej Team
 
Thesis+of+nesrine+abdelkafi.ppt
Thesis+of+nesrine+abdelkafi.pptThesis+of+nesrine+abdelkafi.ppt
Thesis+of+nesrine+abdelkafi.pptPtidej Team
 

More from Ptidej Team (20)

From IoT to Software Miniaturisation
From IoT to Software MiniaturisationFrom IoT to Software Miniaturisation
From IoT to Software Miniaturisation
 
Presentation
PresentationPresentation
Presentation
 
Presentation
PresentationPresentation
Presentation
 
Presentation
PresentationPresentation
Presentation
 
Presentation by Lionel Briand
Presentation by Lionel BriandPresentation by Lionel Briand
Presentation by Lionel Briand
 
Manel Abdellatif
Manel AbdellatifManel Abdellatif
Manel Abdellatif
 
Azadeh Kermansaravi
Azadeh KermansaraviAzadeh Kermansaravi
Azadeh Kermansaravi
 
Mouna Abidi
Mouna AbidiMouna Abidi
Mouna Abidi
 
CSED - Manel Grichi
CSED - Manel GrichiCSED - Manel Grichi
CSED - Manel Grichi
 
Cristiano Politowski
Cristiano PolitowskiCristiano Politowski
Cristiano Politowski
 
Will io t trigger the next software crisis
Will io t trigger the next software crisisWill io t trigger the next software crisis
Will io t trigger the next software crisis
 
MIPA
MIPAMIPA
MIPA
 
Thesis+of+laleh+eshkevari.ppt
Thesis+of+laleh+eshkevari.pptThesis+of+laleh+eshkevari.ppt
Thesis+of+laleh+eshkevari.ppt
 
Thesis+of+nesrine+abdelkafi.ppt
Thesis+of+nesrine+abdelkafi.pptThesis+of+nesrine+abdelkafi.ppt
Thesis+of+nesrine+abdelkafi.ppt
 
Medicine15.ppt
Medicine15.pptMedicine15.ppt
Medicine15.ppt
 
Qrs17b.ppt
Qrs17b.pptQrs17b.ppt
Qrs17b.ppt
 
Icpc11c.ppt
Icpc11c.pptIcpc11c.ppt
Icpc11c.ppt
 
Icsme16.ppt
Icsme16.pptIcsme16.ppt
Icsme16.ppt
 
Msr17a.ppt
Msr17a.pptMsr17a.ppt
Msr17a.ppt
 
Icsoc15.ppt
Icsoc15.pptIcsoc15.ppt
Icsoc15.ppt
 

Recently uploaded

08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
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 organizationRadu Cotescu
 
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 Scriptwesley chun
 
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...Miguel Araújo
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
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?Antenna Manufacturer Coco
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
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.pdfsudhanshuwaghmare1
 
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 RobisonAnna Loughnan Colquhoun
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
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 DevelopmentsTrustArc
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
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 CVKhem
 
[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.pdfhans926745
 

Recently uploaded (20)

08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
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
 
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
 
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...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
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?
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
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
 
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
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
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
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
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
 
[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
 

FASE08.ppt

  • 1. A Domain Analysis to Specify Design Defects and Generate Detection Algorithms Naouel Moha, Yann-Gaël Guéhéneuc, Anne-Françoise Le Meur, Laurence Duchien Ptidej Team, GEODES, Université de Montréal, Canada LIFL, INRIA Lille - Nord Europe / ADAM Team, Université de Lille, France FASE’08 29 March - 6 April, 2008
  • 2. Context Moha © A Domain Analysis to Specify Design Defects and Generate Detection Algorithms 2
  • 3. Context Moha © A Domain Analysis to Specify Design Defects and Generate Detection Algorithms 3
  • 4. What Kind of Defects ? Design Patterns are “good” solutions to recurring design problems Design Defects (DDs) are “bad” solutions to recurring problems 2 categories: High-level (global) problems: antipatterns [Brown 98] Low-level (local) problems: code smells* [Fowler 99] “ deviations from specifications or expectations which might lead to ≠ failures in operation ” * Some code smells can be considered as high-level DDs Moha © A Domain Analysis to Specify Design Defects and Generate Detection Algorithms 4
  • 5. What Kind of Defects ? 2 examples of high-level DDs [Brown 98] Blob (God Class) “ Procedural-style design leads to one object with a lion’s share of the responsibilities while most other objects only hold data or execute simple processes ” Large controller class Many fields and methods with a low cohesion* Dependent on the data stored in associated data classes *How closely the methods are related to the instance variables in the class. Moha © A Domain Analysis to Specify Design Defects and Generate Detection Algorithms 5
  • 6. What Kind of Defects ? 2 examples of high-level DDs [Brown 98] Spaghetti Code “ Ad hoc software structure makes it difficult to extend and optimize code. ” Procedural thinking in OO programming Lack of structure : no inheritance, no reuse, no polymorphism Long methods process oriented with no parameters and low cohesion Classes with procedural names Use of global variables for processing Moha © A Domain Analysis to Specify Design Defects and Generate Detection Algorithms 6
  • 7. Method DECOR Specification Processing Validation Detection Analysis Domain Moha © A Domain Analysis to Specify Design Defects and Generate Detection Algorithms 7
  • 8. Method DECOR Specification Processing Validation Detection Analysis Domain Moha © A Domain Analysis to Specify Design Defects and Generate Detection Algorithms 8
  • 9. Method DECOR Specification Processing Validation Detection Analysis Domain Contributions Domain analysis of DDs and domain-specific language Explicit process for the specifications Validation : first study on both precision and recall Moha © A Domain Analysis to Specify Design Defects and Generate Detection Algorithms 9
  • 10. Method DECOR Specification Processing Validation Detection Analysis Domain Moha © A Domain Analysis to Specify Design Defects and Generate Detection Algorithms 10
  • 11. DECOR Method Domain Analysis On all defects On each defect On each system Source code Source code 1 2 3 4 5 Specification of the system of the system Processing Validation Vocabulary Detection Analysis Domain Text-based descriptions Specifications Operational Suspicious Classes having of design defects specifications classes design defects Taxonomy Brown et al. (1998) Demeyer (2002) Dudney (2003) Marinescu (2004) Marinescu (2004) Fowler (1999) Marinescu (2004) Alikacem (2006) Munro (2005) Riel (1996) Munro (2005) Travassos : manual detection (1999) Webster (1995) Alikacem (2006) Tools: SmallLint, PMD, CROCOPAT The Spaghetti Code is an antipattern that is characteristic Chapter 1 of procedural thinking in object- oriented programming. Spaghetti Code is revealed by classes with Descriptions of antipatterns no structure, declaring long methods with no parameters, and utilising global variables for processing. Names of classes and methods may suggest procedural programming. Spaghetti Code does not exploit and prevents the use of object- orientation mechanisms, polymorphism and inheritance. Moha © A Domain Analysis to Specify Design Defects and Generate Detection Algorithms 11
  • 12. DECOR Method Domain Analysis On all defects On each defect On each system Source code Source code 1 2 3 4 5 Specification of the system of the system Processing Validation Vocabulary Detection Analysis Domain Text-based descriptions Specifications Operational Suspicious Classes having of design defects specifications classes design defects Taxonomy Brown et al. (1998) Demeyer (2002) Dudney (2003) Marinescu (2004) Marinescu (2004) Fowler (1999) Marinescu (2004) Alikacem (2006) Munro (2005) Riel (1996) Munro (2005) Travassos : manual detection (1999) Webster (1995) Alikacem (2006) Tools: SmallLint, PMD, CROCOPAT The Spaghetti Code is an antipattern that is characteristic Chapter 1 of procedural thinking in object- oriented programming. Spaghetti Code is revealed by classes with Descriptions of antipatterns no structure, declaring long methods with no parameters, and utilising global variables for Identification of Key Concepts processing. Names of classes and methods may suggest procedural programming. Spaghetti Code does not exploit and prevents the use of object- orientation mechanisms, polymorphism and inheritance. Moha © A Domain Analysis to Specify Design Defects and Generate Detection Algorithms 12
  • 13. DECOR Method Domain Analysis On all defects On each defect On each system Source code Source code 1 2 3 4 5 Specification of the system of the system Processing Validation Vocabulary Detection Analysis Domain Text-based descriptions Specifications Operational Suspicious Classes having of design defects specifications classes design defects Taxonomy Brown et al. (1998) Demeyer (2002) Dudney (2003) Marinescu (2004) Marinescu (2004) Fowler (1999) Marinescu (2004) Alikacem (2006) Munro (2005) Riel (1996) Munro (2005) Travassos : manual detection (1999) Webster (1995) Alikacem (2006) Tools: SmallLint, PMD, CROCOPAT Moha © A Domain Analysis to Specify Design Defects and Generate Detection Algorithms 13
  • 14. DECOR Method Domain Analysis On all defects On each defect On each system Source code Source code 1 2 3 4 5 Specification of the system of the system Processing Validation Vocabulary Detection Analysis Domain Text-based descriptions Specifications Operational Suspicious Classes having of design defects specifications classes design defects Taxonomy Brown et al. (1998) Demeyer (2002) Dudney (2003) Marinescu (2004) Marinescu (2004) Fowler (1999) Marinescu (2004) Alikacem (2006) Munro (2005) Riel (1996) Munro (2005) Travassos : manual detection (1999) Webster (1995) Alikacem (2006) Tools: SmallLint, PMD, CROCOPAT Moha © A Domain Analysis to Specify Design Defects and Generate Detection Algorithms 14
  • 15. Method DECOR Specification Processing Validation Detection Analysis Domain Moha © A Domain Analysis to Specify Design Defects and Generate Detection Algorithms 15
  • 16. DECOR Method Specifications On all defects On each defect On each system Source code Source code 1 2 3 4 5 Specification of the system of the system Processing Validation Vocabulary Detection Analysis Domain Text-based descriptions Specifications Operational Suspicious Classes having of design defects specifications classes design defects Taxonomy Brown et al. (1998) Demeyer (2002) Dudney (2003) Marinescu (2004) Marinescu (2004) Fowler (1999) Marinescu (2004) Alikacem (2006) Munro (2005) Riel (1996) Munro (2005) Travassos : manual detection (1999) Webster (1995) Alikacem (2006) Tools: SmallLint, PMD, CROCOPAT SADSL (Software Architectural Defect Specification Language) Language based on a meta-model for specifying DDs CODESMELL define LongMethod as METRIC LOC_METHOD with VERY HIGH and 10.0 ; CODESMELL define NoParameter as METRIC NMNOPARAM with VERY HIGH and 5.0 ; CODESMELL define NoInheritance as METRIC DIT with 1 and 0.0 ; CODESMELL define NoPolymorphism as STRUC NO_POLYMORPHISM ; CODESMELL define ProceduralName as LEXIC CLASS_NAME with (Make, Create, Exec) ; CODESMELL define GlobalVariable as STRUC USE_GLOBAL_VARIABLE ; ANTIPATTERN define SpaghettiCode as { ((LongMethod INTER NoParameter) INTER (NoInheritance UNION NoPolymorphism)) INTER (ProceduralName UNION UseGlobalVariable) } ; Moha © A Domain Analysis to Specify Design Defects and Generate Detection Algorithms 16
  • 17. DECOR Method Specifications On all defects On each defect On each system Source code Source code 1 2 3 4 5 Specification of the system of the system Processing Validation Vocabulary Detection Analysis Domain Text-based descriptions Specifications Operational Suspicious Classes having of design defects specifications classes design defects Taxonomy Brown et al. (1998) Demeyer (2002) Dudney (2003) Marinescu (2004) Marinescu (2004) Fowler (1999) Marinescu (2004) Alikacem (2006) Munro (2005) Riel (1996) Munro (2005) Travassos : manual detection (1999) Webster (1995) Alikacem (2006) Tools: SmallLint, PMD, CROCOPAT SADSL (Software Architectural Defect Specification Language) Language based on a meta-model for specifying DDs CODESMELL define LongMethod as METRIC LOC_METHOD with VERY HIGH and 10.0 ; CODESMELL define NoParameter as METRIC NMNOPARAM with VERY HIGH and 5.0 ; CODESMELL define NoInheritance as METRIC DIT with 1 and 0.0 ; CODESMELL define NoPolymorphism as STRUC NO_POLYMORPHISM ; CODESMELL define ProceduralName as LEXIC CLASS_NAME with (Make, Create, Exec) ; CODESMELL define GlobalVariable as STRUC USE_GLOBAL_VARIABLE ; ANTIPATTERN define SpaghettiCode as { ((LongMethod INTER NoParameter) INTER (NoInheritance UNION NoPolymorphism)) INTER (ProceduralName UNION UseGlobalVariable) } ; Moha © A Domain Analysis to Specify Design Defects and Generate Detection Algorithms 17
  • 18. DECOR Method Specifications On all defects On each defect On each system Source code Source code 1 2 3 4 5 Specification of the system of the system Processing Validation Vocabulary Detection Analysis Domain Text-based descriptions Specifications Operational Suspicious Classes having of design defects specifications classes design defects Taxonomy Brown et al. (1998) Demeyer (2002) Dudney (2003) Marinescu (2004) Marinescu (2004) Fowler (1999) Marinescu (2004) Alikacem (2006) Munro (2005) Riel (1996) Munro (2005) Travassos : manual detection (1999) Webster (1995) Alikacem (2006) Tools: SmallLint, PMD, CROCOPAT Meta-model SADDL (Software Architectural Defect Definition Language) Moha © A Domain Analysis to Specify Design Defects and Generate Detection Algorithms 18
  • 19. Method DECOR Specification Processing Validation Detection Analysis Domain Moha © A Domain Analysis to Specify Design Defects and Generate Detection Algorithms 19
  • 20. Method DECOR Specification Generation Validation Algorithm Detection Analysis Domain Moha © A Domain Analysis to Specify Design Defects and Generate Detection Algorithms 20
  • 21. DECOR Method Algorithm Generation On all defects On each defect On each system Source code Source code 1 2 3 4 5 Specification of the system of the system Processing Validation Vocabulary Detection Analysis Domain Text-based descriptions Specifications Operational Suspicious Classes having of design defects specifications classes design defects Taxonomy Brown et al. (1998) Demeyer (2002) Dudney (2003) Marinescu (2004) Marinescu (2004) Fowler (1999) Marinescu (2004) Alikacem (2006) Munro (2005) Riel (1996) Munro (2005) Travassos : manual detection (1999) Webster (1995) Alikacem (2006) Tools: SmallLint, PMD, CROCOPAT Moha © A Domain Analysis to Specify Design Defects and Generate Detection Algorithms 21
  • 22. DECOR Method Algorithm Generation On all defects On each defect On each system Source code Source code 1 2 3 4 5 Specification of the system of the system Processing Validation Vocabulary Detection Analysis Domain Text-based descriptions Specifications Operational Suspicious Classes having of design defects specifications classes design defects Taxonomy Brown et al. (1998) Demeyer (2002) Dudney (2003) Marinescu (2004) Marinescu (2004) Fowler (1999) Marinescu (2004) Alikacem (2006) Munro (2005) Riel (1996) Munro (2005) Travassos : manual detection (1999) Webster (1995) Alikacem (2006) Tools: SmallLint, PMD, CROCOPAT Moha © A Domain Analysis to Specify Design Defects and Generate Detection Algorithms 22
  • 23. DECOR Method Algorithm Generation On all defects On each defect On each system Source code Source code 1 2 3 4 5 Specification of the system of the system Processing Validation Vocabulary Detection Analysis Domain Text-based descriptions Specifications Operational Suspicious Classes having of design defects specifications classes design defects Taxonomy Brown et al. (1998) Demeyer (2002) Dudney (2003) Marinescu (2004) Marinescu (2004) Fowler (1999) Marinescu (2004) Alikacem (2006) Munro (2005) Riel (1996) Munro (2005) Travassos : manual detection (1999) Webster (1995) Alikacem (2006) Tools: SmallLint, PMD, CROCOPAT Consistency and domain-specific analyses - Verify that specifications are not inconsistent, redundant, or incomplete - Ex: 2 rules with same names but different properties 2 rules with different names but identical properties Moha © A Domain Analysis to Specify Design Defects and Generate Detection Algorithms 23
  • 24. DECOR Method Algorithm Generation On all defects On each defect On each system Source code Source code 1 2 3 4 5 Specification of the system of the system Processing Validation Vocabulary Detection Analysis Domain Text-based descriptions Specifications Operational Suspicious Classes having of design defects specifications classes design defects Taxonomy Brown et al. (1998) Demeyer (2002) Dudney (2003) Marinescu (2004) Marinescu (2004) Fowler (1999) Marinescu (2004) Alikacem (2006) Munro (2005) Riel (1996) Munro (2005) Travassos : manual detection (1999) Webster (1995) Alikacem (2006) Tools: SmallLint, PMD, CROCOPAT Complexity : O((c+op) X n) SAD Framework c : number of properties - Meta-model to represent OO programs op : number of operators - Repository of metrics n : number of classes - Services to analyse structural relationships - Services to perform structural and lexical analyses Moha © A Domain Analysis to Specify Design Defects and Generate Detection Algorithms 24
  • 25. DECOR Method Algorithm Generation On all defects On each defect On each system Source code Source code 1 2 3 4 5 Specification of the system of the system Processing Validation Vocabulary Detection Analysis Domain Text-based descriptions Specifications Operational Suspicious Classes having of design defects specifications classes design defects Taxonomy Brown et al. (1998) Demeyer (2002) Dudney (2003) Marinescu (2004) Marinescu (2004) Fowler (1999) Marinescu (2004) Alikacem (2006) Munro (2005) Riel (1996) Munro (2005) Travassos : manual detection (1999) Webster (1995) Alikacem (2006) Tools: SmallLint, PMD, CROCOPAT 1 public class <CODESMELL>Detection 2 extends CodeSmellDetection 3 implements ICodeSmellDetection { 4 public Set performDetection() { 5 IClass c = iteratorOnClasses.next(); 6 LOCofSetOfClasses.add( 7 Metrics.compute(<METRIC>, c)); 8 ... 9 BoxPlot boxPlot = new BoxPlot( 10 <METRIC>ofSetOfClasses, <FUZZINESS>); 11 Map setOfOutliers = 12 boxPlot.<ORDINAL_VALUE>(); 13 ... 14 suspiciousCodeSmells.add( new CodeSmell( 15 <CODESMELL>, setOfOutliers)); 16 ... 17 return suspiciousCodeSmells; 18 } Visitor Template Moha © A Domain Analysis to Specify Design Defects and Generate Detection Algorithms 25
  • 26. DECOR Method Algorithm Generation On all defects On each defect On each system Source code Source code 1 2 3 4 5 Specification of the system of the system Processing Validation Vocabulary Detection Analysis Domain Text-based descriptions Specifications Operational Suspicious Classes having of design defects specifications classes design defects Taxonomy Brown et al. (1998) Demeyer (2002) Dudney (2003) Marinescu (2004) Marinescu (2004) Fowler (1999) Marinescu (2004) Alikacem (2006) Munro (2005) Riel (1996) Munro (2005) Travassos : manual detection (1999) Webster (1995) Alikacem (2006) Tools: SmallLint, PMD, CROCOPAT Visitor Generated Code Moha © A Domain Analysis to Specify Design Defects and Generate Detection Algorithms 26
  • 27. Method DECOR Specification Processing Validation Detection Analysis Domain Moha © A Domain Analysis to Specify Design Defects and Generate Detection Algorithms 27
  • 28. Method DECOR Specification Processing Validation Detection Analysis Domain Moha © A Domain Analysis to Specify Design Defects and Generate Detection Algorithms 28
  • 29. DECOR Method Experiments On all defects On each defect On each system Source code Source code 1 2 3 4 5 Specification of the system of the system Processing Validation Vocabulary Detection Analysis Domain Text-based descriptions Specifications Operational Suspicious Classes having of design defects specifications classes design defects Taxonomy Brown et al. (1998) Demeyer (2002) Dudney (2003) Marinescu (2004) Marinescu (2004) Fowler (1999) Marinescu (2004) Alikacem (2006) Munro (2005) Riel (1996) Munro (2005) Travassos : manual detection (1999) Webster (1995) Alikacem (2006) Tools: SmallLint, PMD, CROCOPAT Goal : Validate the generated algorithms in terms of precision and recall Xerces: 71,217 LOC, 513 classes and 162 interfaces Nb of Existing Detected Detection Defects Precision Recall classes Defects Defects Time Blob 39 (7,6%) 44 (8,6%) 88,6% 100% 2,45s Functional Decomp. 15 (2,9%) 29 (5,6%) 51,7% 100% 0,91s 513 Spaghetti Code 46 (9,0%) 76 (14,8%) 60,5% 100% 0,23s Swiss Army Knife 23 (4,5%) 56 (10,9%) 41,1% 100% 0,08s Moha © A Domain Analysis to Specify Design Defects and Generate Detection Algorithms 29
  • 30. Demonstration Moha © A Domain Analysis to Specify Design Defects and Generate Detection Algorithms 30
  • 31. Conclusion Method DECOR Automate the generation of detection algorithms from specifications written using a domain-specific language Contributions The domain-specific language defined from a domain analysis Explicit process for the generation of detection algorithms Validation in terms of precision and recall Future Work Experiments on other systems and defects Comparison with existing approaches Correction of defects (in progress) Moha © A Domain Analysis to Specify Design Defects and Generate Detection Algorithms 31
  • 32. Questions Contact: mohanaou@iro.umontreal.ca http://www-etud.iro.umontreal.ca/~mohanaou Thanks for your attention ! Moha © A Domain Analysis to Specify Design Defects and Generate Detection Algorithms 32
  • 33. DECOR Method Algorithm Generation On all defects On each defect On each system Source code Source code 1 2 3 4 5 Specification of the system of the system Processing Validation Vocabulary Detection Analysis Domain Text-based descriptions Specifications Operational Suspicious Classes having of design defects specifications classes design defects Taxonomy Brown et al. (1998) Demeyer (2002) Dudney (2003) Marinescu (2004) Marinescu (2004) Fowler (1999) Marinescu (2004) Alikacem (2006) Munro (2005) Riel (1996) Munro (2005) Travassos : manual detection (1999) Webster (1995) Alikacem (2006) Tools: SmallLint, PMD, CROCOPAT Box-plot for metrics with ordinal values Moha © A Domain Analysis to Specify Design Defects and Generate Detection Algorithms 33