SlideShare a Scribd company logo
1 of 13
Download to read offline
Automatic Generation of
Detection Algorithms for Design Defects


Naouel Moha, Yann-Gaël Guéhéneuc, Pierre Leduc

     Ptidej team, GEODES, University of Montreal, Canada
     LIFL, INRIA project Jacquard, University of Lille, France


                         ASE 2006
             September 18-22, 2006, Tokyo, Japan
Context
   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 [BRO 98]
           Low-level (local) problems: code smells [FOW 99]


   Why it is important to detect DDs ?
        DDs lessen the quality of OO architectures and impede their
        evolution and their maintenance
        Maintenance is expensive because of DDs [PER 92] : adding,
        debugging, and evolving of features are difficult
        A good software architecture without DDs: easier to understand,
        change, and thus maintain
Moha © ASE 2006        Automatic Generation of Detection Algorithms for Design Defects   2
Context
  2 examples of high-level DDs

                         Blob
                              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. Measure: LCOM (Lack of Cohesion Metric)




Moha © ASE 2006   Automatic Generation of Detection Algorithms for Design Defects          3
Context
  2 examples of high-level DDs

                         Spaghetti Code
                              Procedural thinking in OO programming

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

                              Long process-oriented methods with no
                              parameters and low cohesion

                              Excessive use of class and global variables for
                              processing




Moha © ASE 2006   Automatic Generation of Detection Algorithms for Design Defects   4
Problem Description

  What are the problems ?
       Textual descriptions of DDs [Brown 98] [Fowler 99]
                  Lack of precision and misinterpretations
                  Difficult to build detection algorithms from textual descriptions

       Lack of precise specifications and tools: metrics only                                    [Marinescu 04]
       [Tools: SmallLint, PMD]
                  Metrics only : metrics cannot express important structural and semantic
                  properties

       Lack of work on high-level DDs
                  Focus only on low-level DDs (code smells)

       Semi-manual detection [Marinescu 04] [Munro 05]



Moha © ASE 2006                Automatic Generation of Detection Algorithms for Design Defects                    5
Solution
    How to address these problems ?
              We propose a language and a framework
              to specify precisely high-level DDs in order
              to ease and automate their detection

  We define a systematic method, called DECOR, to specify high-level DDs
  significantly and to generate detection and correction algorithms
  from the specifications of DDs


                                                                              Generation of
                                                        6
                                                s1              Detection & Correction Algorithms
                                            Step



                                          Ste
                                             ps
                                                7
                                                       10
   Method in 10 steps                                                            Application of
                                                                   Detection & Correction Algorithms


Moha © ASE 2006            Automatic Generation of Detection Algorithms for Design Defects             6
Our Approach
 We define a systematic method, called DECOR, to specify high-level DDs
 significantly and to generate detection and correction algorithms
 from the specifications of DDs


     Illustration with the Blob

                            Blob
                                 Large controller class

                                 Many fields and methods with a low cohesion

                                 Dependent on the data stored in data classes
                                 associated




Moha © ASE 2006      Automatic Generation of Detection Algorithms for Design Defects   7
Specification of Design Defects
Rule Cards
           More structured description

RULE_CARD : Blob {

  RULE : Blob {ASSOC: associated FROM: MainClass ONE TO: DataClass MANY } ;

  RULE : MainClass {UNION LargeClassLowCohesion ControllerClass } ;

  RULE : LargeClassLowCohesion {UNION LargeClass LowCohesion } ;

  RULE : LargeClass { (METRIC: NMD + NAD, VERY_HIGH) } ;

  RULE : LowCohesion { (METRIC: LCOM5, VERY_HIGH) } ;

  RULE : ControllerClass {UNION (SEMANTIC: METHODNAME, {Process, Main, Ctrl})
                                (SEMANTIC: CLASSNAME, {Process, Main, Ctrl)};

  RULE : DataClass { (STRUCT: METHOD, Accessor) } ;

} ;

Moha © ASE 2006      Automatic Generation of Detection Algorithms for Design Defects   8
Generation of Detection Algorithms
        SAD Framework (Software Architectural Defects)
             A meta-model to instantiate rule cards of DDs
             A parser to analyse and reify rule cards
             A repository of metrics
             Services to analyse structural relationships
             Services to perform semantic and structural analyses

        Concrete Generation
        1. Parse the rule card
        2. Build a model representing this rule card
        3. Visit the model of the rule card
        4. Generate the detection algorithm




Moha © ASE 2006         Automatic Generation of Detection Algorithms for Design Defects   9
Our Approach
 We define a systematic method, called DECOR, to specify high-level DDs
 significantly and to generate detection and correction algorithms
 from the specifications of DDs




                                                                        Generation of
                                                  6
                                          s1              Detection & Correction Algorithms
                                      Step



                                    Ste
                                       ps
                                          7
                                                 10
   Method in 10 steps
                                                                        Application of
                                                          Detection & Correction Algorithms


Moha © ASE 2006      Automatic Generation of Detection Algorithms for Design Defects          10
Preliminary Results
We specify and detect DDs in several open-source programs
                                                         Blob
                  ArgoUML            Azureus          GanttProject             PMD           QuickUML
                   113 KLOC         192 KLOC             22 KLOC             42 KLOC            9 KLOC       Total
                  1230 classes     1449 classes         188 classes         423 classes       142 classes
 Effectifs            91                143                  19                  15                 3         271
                    70/91             82/143              10/19                3/15               1/3       166/271
 Precisions
                   = 76.9%           = 57.3%             = 52.6%              = 20%            = 33.3%      = 61.5%
 Time                40.5s              2m                  5.6s               31.6s               2.1s     3m 19.8s


                                                 Spaghetti Code
                  ArgoUML            Azureus          GanttProject             PMD           QuickUML        Total
 Effectifs            26                 35                   8                  11                 1         81
                    21/26             29/35                 6/8                6/11                 0/1      62/81
 Precisions
                   = 80.7%           = 82.8%              = 75%              = 54.5%               = 0%     = 76.6%
 Time                 39s             1m55s                 5.4s                31s                1.9s      3m12s

                                                                           Results are encouraging ! ☺
Moha © ASE 2006                  Automatic Generation of Detection Algorithms for Design Defects                     11
Conclusion
     Contributions
       Meta-model enriched with semantic and structural
       properties
       Rule-based Language & Framework
       Method DECOR in 10 steps

     Our approach
         A systematic method based on a meta-model and a rule-based
         language to generate automatically detection and correction
         algos of high-level DDs

     Future Work
         Correction of DDs
         More defects and case studies including commercial programs
         Use of a dictionnary such as WordNet for semantics
Moha © ASE 2006       Automatic Generation of Detection Algorithms for Design Defects   12
Come see my poster !




                      Thursday, 21st
                       15:30 - 17:30
                      Room M3-M4
Moha © ASE 2006   Automatic Generation of Detection Algorithms for Design Defects   13

More Related Content

Similar to ASE06.ppt

A tale of bug prediction in software development
A tale of bug prediction in software developmentA tale of bug prediction in software development
A tale of bug prediction in software development
Martin Pinzger
 
Best practices in enterprise applications
Best practices in enterprise applicationsBest practices in enterprise applications
Best practices in enterprise applications
Chandra Sekhar Saripaka
 

Similar to ASE06.ppt (20)

Ase06.ppt
Ase06.pptAse06.ppt
Ase06.ppt
 
Cascon06 tooldemo.ppt
Cascon06 tooldemo.pptCascon06 tooldemo.ppt
Cascon06 tooldemo.ppt
 
Cascon06 tooldemo.ppt
Cascon06 tooldemo.pptCascon06 tooldemo.ppt
Cascon06 tooldemo.ppt
 
Fase08.ppt
Fase08.pptFase08.ppt
Fase08.ppt
 
Accelerated Disassembly, Reconstruction and Reversing training public slides
Accelerated Disassembly, Reconstruction and Reversing training public slidesAccelerated Disassembly, Reconstruction and Reversing training public slides
Accelerated Disassembly, Reconstruction and Reversing training public slides
 
Quick fix generation for DSMLs
Quick fix generation for DSMLsQuick fix generation for DSMLs
Quick fix generation for DSMLs
 
A Tale of Experiments on Bug Prediction
A Tale of Experiments on Bug PredictionA Tale of Experiments on Bug Prediction
A Tale of Experiments on Bug Prediction
 
Parasoft .TEST, Write better C# Code Using Data Flow Analysis
Parasoft .TEST, Write better C# Code Using  Data Flow Analysis Parasoft .TEST, Write better C# Code Using  Data Flow Analysis
Parasoft .TEST, Write better C# Code Using Data Flow Analysis
 
CRASH Special Report - JEE
CRASH Special Report - JEECRASH Special Report - JEE
CRASH Special Report - JEE
 
Bug Prediction Based on Fine-Grained Module Histories
Bug Prediction Based on Fine-Grained Module HistoriesBug Prediction Based on Fine-Grained Module Histories
Bug Prediction Based on Fine-Grained Module Histories
 
Biomedical Signal and Image Analytics using MATLAB
Biomedical Signal and Image Analytics using MATLABBiomedical Signal and Image Analytics using MATLAB
Biomedical Signal and Image Analytics using MATLAB
 
A tale of bug prediction in software development
A tale of bug prediction in software developmentA tale of bug prediction in software development
A tale of bug prediction in software development
 
Production model lifecycle management 2016 09
Production model lifecycle management 2016 09Production model lifecycle management 2016 09
Production model lifecycle management 2016 09
 
Aniruddha_More_Resume
Aniruddha_More_ResumeAniruddha_More_Resume
Aniruddha_More_Resume
 
A tale of experiments on bug prediction
A tale of experiments on bug predictionA tale of experiments on bug prediction
A tale of experiments on bug prediction
 
Best practices in enterprise applications
Best practices in enterprise applicationsBest practices in enterprise applications
Best practices in enterprise applications
 
Multi step automated refactoring for code smell
Multi step automated refactoring for code smellMulti step automated refactoring for code smell
Multi step automated refactoring for code smell
 
Multi step automated refactoring for code smell
Multi step automated refactoring for code smellMulti step automated refactoring for code smell
Multi step automated refactoring for code smell
 
Solve cross cutting concerns with aspect oriented programming (aop)
Solve cross cutting concerns with aspect oriented programming (aop)Solve cross cutting concerns with aspect oriented programming (aop)
Solve cross cutting concerns with aspect oriented programming (aop)
 
PVS-Studio advertisement - static analysis of C/C++ code
PVS-Studio advertisement - static analysis of C/C++ codePVS-Studio advertisement - static analysis of C/C++ code
PVS-Studio advertisement - static analysis of C/C++ code
 

More from Ptidej 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

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
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
 
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...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
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
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
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 Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
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
 
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
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 

ASE06.ppt

  • 1. Automatic Generation of Detection Algorithms for Design Defects Naouel Moha, Yann-Gaël Guéhéneuc, Pierre Leduc Ptidej team, GEODES, University of Montreal, Canada LIFL, INRIA project Jacquard, University of Lille, France ASE 2006 September 18-22, 2006, Tokyo, Japan
  • 2. Context 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 [BRO 98] Low-level (local) problems: code smells [FOW 99] Why it is important to detect DDs ? DDs lessen the quality of OO architectures and impede their evolution and their maintenance Maintenance is expensive because of DDs [PER 92] : adding, debugging, and evolving of features are difficult A good software architecture without DDs: easier to understand, change, and thus maintain Moha © ASE 2006 Automatic Generation of Detection Algorithms for Design Defects 2
  • 3. Context 2 examples of high-level DDs Blob 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. Measure: LCOM (Lack of Cohesion Metric) Moha © ASE 2006 Automatic Generation of Detection Algorithms for Design Defects 3
  • 4. Context 2 examples of high-level DDs Spaghetti Code Procedural thinking in OO programming Lack of structure : no inheritance, no reuse, no polymorphism Long process-oriented methods with no parameters and low cohesion Excessive use of class and global variables for processing Moha © ASE 2006 Automatic Generation of Detection Algorithms for Design Defects 4
  • 5. Problem Description What are the problems ? Textual descriptions of DDs [Brown 98] [Fowler 99] Lack of precision and misinterpretations Difficult to build detection algorithms from textual descriptions Lack of precise specifications and tools: metrics only [Marinescu 04] [Tools: SmallLint, PMD] Metrics only : metrics cannot express important structural and semantic properties Lack of work on high-level DDs Focus only on low-level DDs (code smells) Semi-manual detection [Marinescu 04] [Munro 05] Moha © ASE 2006 Automatic Generation of Detection Algorithms for Design Defects 5
  • 6. Solution How to address these problems ? We propose a language and a framework to specify precisely high-level DDs in order to ease and automate their detection We define a systematic method, called DECOR, to specify high-level DDs significantly and to generate detection and correction algorithms from the specifications of DDs Generation of 6 s1 Detection & Correction Algorithms Step Ste ps 7 10 Method in 10 steps Application of Detection & Correction Algorithms Moha © ASE 2006 Automatic Generation of Detection Algorithms for Design Defects 6
  • 7. Our Approach We define a systematic method, called DECOR, to specify high-level DDs significantly and to generate detection and correction algorithms from the specifications of DDs Illustration with the Blob Blob Large controller class Many fields and methods with a low cohesion Dependent on the data stored in data classes associated Moha © ASE 2006 Automatic Generation of Detection Algorithms for Design Defects 7
  • 8. Specification of Design Defects Rule Cards More structured description RULE_CARD : Blob { RULE : Blob {ASSOC: associated FROM: MainClass ONE TO: DataClass MANY } ; RULE : MainClass {UNION LargeClassLowCohesion ControllerClass } ; RULE : LargeClassLowCohesion {UNION LargeClass LowCohesion } ; RULE : LargeClass { (METRIC: NMD + NAD, VERY_HIGH) } ; RULE : LowCohesion { (METRIC: LCOM5, VERY_HIGH) } ; RULE : ControllerClass {UNION (SEMANTIC: METHODNAME, {Process, Main, Ctrl}) (SEMANTIC: CLASSNAME, {Process, Main, Ctrl)}; RULE : DataClass { (STRUCT: METHOD, Accessor) } ; } ; Moha © ASE 2006 Automatic Generation of Detection Algorithms for Design Defects 8
  • 9. Generation of Detection Algorithms SAD Framework (Software Architectural Defects) A meta-model to instantiate rule cards of DDs A parser to analyse and reify rule cards A repository of metrics Services to analyse structural relationships Services to perform semantic and structural analyses Concrete Generation 1. Parse the rule card 2. Build a model representing this rule card 3. Visit the model of the rule card 4. Generate the detection algorithm Moha © ASE 2006 Automatic Generation of Detection Algorithms for Design Defects 9
  • 10. Our Approach We define a systematic method, called DECOR, to specify high-level DDs significantly and to generate detection and correction algorithms from the specifications of DDs Generation of 6 s1 Detection & Correction Algorithms Step Ste ps 7 10 Method in 10 steps Application of Detection & Correction Algorithms Moha © ASE 2006 Automatic Generation of Detection Algorithms for Design Defects 10
  • 11. Preliminary Results We specify and detect DDs in several open-source programs Blob ArgoUML Azureus GanttProject PMD QuickUML 113 KLOC 192 KLOC 22 KLOC 42 KLOC 9 KLOC Total 1230 classes 1449 classes 188 classes 423 classes 142 classes Effectifs 91 143 19 15 3 271 70/91 82/143 10/19 3/15 1/3 166/271 Precisions = 76.9% = 57.3% = 52.6% = 20% = 33.3% = 61.5% Time 40.5s 2m 5.6s 31.6s 2.1s 3m 19.8s Spaghetti Code ArgoUML Azureus GanttProject PMD QuickUML Total Effectifs 26 35 8 11 1 81 21/26 29/35 6/8 6/11 0/1 62/81 Precisions = 80.7% = 82.8% = 75% = 54.5% = 0% = 76.6% Time 39s 1m55s 5.4s 31s 1.9s 3m12s Results are encouraging ! ☺ Moha © ASE 2006 Automatic Generation of Detection Algorithms for Design Defects 11
  • 12. Conclusion Contributions Meta-model enriched with semantic and structural properties Rule-based Language & Framework Method DECOR in 10 steps Our approach A systematic method based on a meta-model and a rule-based language to generate automatically detection and correction algos of high-level DDs Future Work Correction of DDs More defects and case studies including commercial programs Use of a dictionnary such as WordNet for semantics Moha © ASE 2006 Automatic Generation of Detection Algorithms for Design Defects 12
  • 13. Come see my poster ! Thursday, 21st 15:30 - 17:30 Room M3-M4 Moha © ASE 2006 Automatic Generation of Detection Algorithms for Design Defects 13