SlideShare a Scribd company logo
1 of 28
Download to read offline
Foutse Khomh, Stéphane Vaucher,
Yann-Gaël Guéhéneuc, and Houari Sahraoui
© Khomh, 2009
Ptidej Team – Pattern-based Quality Evaluation and Enhancement
Department of Computer Engineering and Software Engineering
École Polytechnique de Montréal, Québec, Canada
A Bayesian Approach for
the Detection of Code
and Design Smells
QSIC’09
Jeju-do
2009/08/25
2/27
Outline
Motivation
Context
Problems and Objectives
Previous Work
Our Solution
Bayesian Belief Networks
Experiments
Discussions
Conclusion
3/27
Motivation
Independent IV&V team reviews of
object-oriented software programs
– Assess the quality of programs
– Identify potential problems
• Defects
• Anomalies
• “Bad Smells”
4/27
Context
Code smells and antipatterns
Blob: also called God class [23], is a
class that centralises functionality and
has too many responsibilities. Brown et
al. [4] characterise its structure as a large
controller class that depends on data
stored in several surrounding data
classes
5/27
Problems and Objectives
Problem 1: Sizes of programs can be large
Automate the evaluation process
Problem 2: Resources are limited
Prioritise manual reviews
Problem 3: Quality assessment is subjective
Consider uncertainty in the process
6/27
Previous Work (1/2)
Webster’s book on “antipatterns” [31]
Riel’s 61 heuristics [23]
Beck’s 22 code smells [11]
Brown et al. 40 antipatterns [4]
Travassos et al. manual approach [28]
Marinescu’s detection strategies [17]
(also Munro [19])
Moha et al. rules cards in DECOR [18]
7/27
Previous Work (2/2)
Either no full automation
– Problem 1 is not solved
Or strict rules with classes participating
or not (binary value) to an antipattern
– Problem 2 and 3 are not solved
8/27
Our Solution (1/2)
Assign a probability that a class is
considered an antipattern by a
stakeholder
Guide a manual inspection according to
this probability
Use Bayesian belief network to build a
model of an antipattern and assign a
probability to all classes
9/27
Our Solution (2/2)
Problem 1: Sizes of programs can be large
Assign a probability to all classes of interest
automatically
Problem 2: Resources are limited
Prioritise manual reviews using probabilities
Problem 3: Quality assessment is subjective
Uncertainty is naturally considered using
Bayesian beliefs networks
10/27
BBN (1/3)
A Bayesian Belief Network is a directed
acyclic graph with probability distribution
Graph structure
– Nodes = random variables
– Edges = probabilities dependencies
Each node depends only on its parents
Embody the experts’ knowledge
11/27
BBN (2/3)
Classifier
– C = {smell, not smell}
Input vector describing a class
– <a1, …, an>
– P(A|B) = P(B|A) P(A) / P(B)
12/27
BBN (2/3)
Building a BBN
1. Define its structure
2. Assign/learn its probability tables
13/27
1. Defining the BBN Structure
Based on Moha et al.’s rule cards
– Detection relies on metrics, binary class
relations, and linguistic analysis
– Values are combined using set operators
– Thresholds are statistically defined
(using a box plot)
14/27
Rule Card of Blob
RULE_CARD : Blob {
RULE : Blob { ASSOC : a s s o c i a t e d FROM : m ai n Cl a ss ONE TO : D a t a C l a s s MANY }
;
RULE : MainClass { UNION LargeCla ssLowCohesion C o n t r o l l e r C l a s s } ;
RULE : LargeCla ssLo wCohesion { UNION L a r g e C l a s s LowCohesion } ;
RULE : L a r g e C l a s s { ( METRIC : NMD + NAD, VERY_HIGH , 0 ) } ;
RULE : LowCohesion { ( METRIC : LCOM5, VERY_HIGH , 2 0 ) } ;
RULE : C o n t r o l l e r C l a s s { UNION
( SEMANTIC : METHODNAME , { P r o c e s s , C o n t r o l , C t r l , Command , Cmd,
Proc, UI, Manage, D r i v e } )
( SEMANTIC : CLASSNAME , { P r o c e s s , C o n t r o l , C t r l , Command , Cmd,
Proc , UI, Manage, Drive , System, Subsystem } ) } ;
RULE : D a t a C l a s s { ( STRUCT : METHOD_ACCESSOR , 9 0 ) } ;
};
15/27
Conversion into BBN
Set operators (OR, AND) are learned
using conditional probabilities
Hard thresholds and rules are smoothed
by interpolating values
Binary class relations are counted and
treated as metrics
16/27
BBN Structure for the Blob
17/27
2. Resulting BBN for the Blob
18/27
Experiments
RQ1: To what extent a model built with
a BBN based on an existing rule-based
model is able detect smells in a
program?
RQ2: Is a model built with a BBN better
than a state-of-the-art approach,
DECOR?
19/27
Settings
Programs
– Xerces v2.7.0
– Gantt Project v1.10.2
Oracle: Vote of three groups
(of students) on both programs
20/27
Settings
Calibration (probability tables)
– Local (same-system calibration)
– External (calibrated on one system,
applied to the other)
21/27
Local calibration
On Xerces only
Three-fold cross validation
– 3 groups with 5 Blobs in each
– Combination of 2 groups for calibration,
tested on the other
Inspected Classes
Group1 6
Group2 7
Group3 9
Waste of 8% to 44%
of effort (average 32%)
22/27
External calibration
Probabilities learned on one, applied on other
Precision vs. Recall (per investigation sizes)
Xerces (left), Gantt (right)
23/27
Experiments
RQ1: To what extent a model built with
a BBN based on an existing rule-based
model is able detect smells in a
program?
RQ2: Is a model built with a BBN better
than a state-of-the-art approach,
DECOR?
Better than DECOR
24/27
Discussions (1/2)
Results of BBN are superior to those of
DECOR
External calibration yields good results
even though tweaking is recommended
A well calibrated model should be able
to estimate the number of smells in a
program, but our models overestimate
by a factor of 2
25/27
Discussions (2/2)
Used simple techniques to convert rules
into probability distributions
Worked with discrete probabilities, might
need to be adapted to continuous cases
26/27
Conclusion
Bayesian models support uncertainty in
detection process
Their performance is better than state-
of-the-art rules
External calibration seems to indicate
that this could be used in an industrial
context with minimal costs
Support for automated conversion of
rules to support more design smells
27/27
Acknowledgements
Naouel Moha for providing her data and
code to compare with DECOR
Natural Sciences and Engineering
Research Council of Canada
Canada Research Chair in Software
Patterns and Patterns of Software
28/27
Advertisement
IEEE Software
Special issue on Software Evolution
Deadline: 1st of November, 2009
Publication: July/August 2010
Please do not hesitate to contact me! ☺

More Related Content

Similar to Bayesian Approach for Detecting Code and Design Smells

A defect prediction model based on the relationships between developers and c...
A defect prediction model based on the relationships between developers and c...A defect prediction model based on the relationships between developers and c...
A defect prediction model based on the relationships between developers and c...Vrije Universiteit Brussel
 
International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)ijceronline
 
FIDUCIAL POINTS DETECTION USING SVM LINEAR CLASSIFIERS
FIDUCIAL POINTS DETECTION USING SVM LINEAR CLASSIFIERSFIDUCIAL POINTS DETECTION USING SVM LINEAR CLASSIFIERS
FIDUCIAL POINTS DETECTION USING SVM LINEAR CLASSIFIERScsandit
 
Online learning in estimation of distribution algorithms for dynamic environm...
Online learning in estimation of distribution algorithms for dynamic environm...Online learning in estimation of distribution algorithms for dynamic environm...
Online learning in estimation of distribution algorithms for dynamic environm...André Gonçalves
 
2cee Master Cocomo20071
2cee Master Cocomo200712cee Master Cocomo20071
2cee Master Cocomo20071CS, NcState
 
Threshold benchmarking for feature ranking techniques
Threshold benchmarking for feature ranking techniquesThreshold benchmarking for feature ranking techniques
Threshold benchmarking for feature ranking techniquesjournalBEEI
 
Transcription Factor DNA Binding Prediction
Transcription Factor DNA Binding PredictionTranscription Factor DNA Binding Prediction
Transcription Factor DNA Binding PredictionUT, San Antonio
 
Credit Default Swap (CDS) Rate Construction by Machine Learning Techniques
Credit Default Swap (CDS) Rate Construction by Machine Learning TechniquesCredit Default Swap (CDS) Rate Construction by Machine Learning Techniques
Credit Default Swap (CDS) Rate Construction by Machine Learning TechniquesZhongmin Luo
 
Types of Machine Learnig Algorithms(CART, ID3)
Types of Machine Learnig Algorithms(CART, ID3)Types of Machine Learnig Algorithms(CART, ID3)
Types of Machine Learnig Algorithms(CART, ID3)Fatimakhan325
 
A Hierarchical Feature Set optimization for effective code change based Defec...
A Hierarchical Feature Set optimization for effective code change based Defec...A Hierarchical Feature Set optimization for effective code change based Defec...
A Hierarchical Feature Set optimization for effective code change based Defec...IOSR Journals
 
Nature-Based Prediction Model of Bug Reports Based on Ensemble Machine Learni...
Nature-Based Prediction Model of Bug Reports Based on Ensemble Machine Learni...Nature-Based Prediction Model of Bug Reports Based on Ensemble Machine Learni...
Nature-Based Prediction Model of Bug Reports Based on Ensemble Machine Learni...Shakas Technologies
 
An enhanced kernel weighted collaborative recommended system to alleviate spa...
An enhanced kernel weighted collaborative recommended system to alleviate spa...An enhanced kernel weighted collaborative recommended system to alleviate spa...
An enhanced kernel weighted collaborative recommended system to alleviate spa...IJECEIAES
 
Algorithm ExampleFor the following taskUse the random module .docx
Algorithm ExampleFor the following taskUse the random module .docxAlgorithm ExampleFor the following taskUse the random module .docx
Algorithm ExampleFor the following taskUse the random module .docxdaniahendric
 
Low rank models for recommender systems with limited preference information
Low rank models for recommender systems with limited preference informationLow rank models for recommender systems with limited preference information
Low rank models for recommender systems with limited preference informationEvgeny Frolov
 
LCBM: Statistics-Based Parallel Collaborative Filtering
LCBM: Statistics-Based Parallel Collaborative FilteringLCBM: Statistics-Based Parallel Collaborative Filtering
LCBM: Statistics-Based Parallel Collaborative FilteringFabio Petroni, PhD
 
EFFECTIVE IMPLEMENTATION OF AGILE PRACTICES – OBJECT ORIENTED METRICS TOOL TO...
EFFECTIVE IMPLEMENTATION OF AGILE PRACTICES – OBJECT ORIENTED METRICS TOOL TO...EFFECTIVE IMPLEMENTATION OF AGILE PRACTICES – OBJECT ORIENTED METRICS TOOL TO...
EFFECTIVE IMPLEMENTATION OF AGILE PRACTICES – OBJECT ORIENTED METRICS TOOL TO...ijseajournal
 
Revisiting the Notion of Diversity in Software Testing
Revisiting the Notion of Diversity in Software TestingRevisiting the Notion of Diversity in Software Testing
Revisiting the Notion of Diversity in Software TestingLionel Briand
 
Anomaly Detection in Temporal data Using Kmeans Clustering with C5.0
Anomaly Detection in Temporal data Using Kmeans Clustering with C5.0Anomaly Detection in Temporal data Using Kmeans Clustering with C5.0
Anomaly Detection in Temporal data Using Kmeans Clustering with C5.0theijes
 
DSUS_MAO_2012_Jie
DSUS_MAO_2012_JieDSUS_MAO_2012_Jie
DSUS_MAO_2012_JieMDO_Lab
 

Similar to Bayesian Approach for Detecting Code and Design Smells (20)

A defect prediction model based on the relationships between developers and c...
A defect prediction model based on the relationships between developers and c...A defect prediction model based on the relationships between developers and c...
A defect prediction model based on the relationships between developers and c...
 
International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)
 
FIDUCIAL POINTS DETECTION USING SVM LINEAR CLASSIFIERS
FIDUCIAL POINTS DETECTION USING SVM LINEAR CLASSIFIERSFIDUCIAL POINTS DETECTION USING SVM LINEAR CLASSIFIERS
FIDUCIAL POINTS DETECTION USING SVM LINEAR CLASSIFIERS
 
Online learning in estimation of distribution algorithms for dynamic environm...
Online learning in estimation of distribution algorithms for dynamic environm...Online learning in estimation of distribution algorithms for dynamic environm...
Online learning in estimation of distribution algorithms for dynamic environm...
 
2cee Master Cocomo20071
2cee Master Cocomo200712cee Master Cocomo20071
2cee Master Cocomo20071
 
Threshold benchmarking for feature ranking techniques
Threshold benchmarking for feature ranking techniquesThreshold benchmarking for feature ranking techniques
Threshold benchmarking for feature ranking techniques
 
Transcription Factor DNA Binding Prediction
Transcription Factor DNA Binding PredictionTranscription Factor DNA Binding Prediction
Transcription Factor DNA Binding Prediction
 
Credit Default Swap (CDS) Rate Construction by Machine Learning Techniques
Credit Default Swap (CDS) Rate Construction by Machine Learning TechniquesCredit Default Swap (CDS) Rate Construction by Machine Learning Techniques
Credit Default Swap (CDS) Rate Construction by Machine Learning Techniques
 
Types of Machine Learnig Algorithms(CART, ID3)
Types of Machine Learnig Algorithms(CART, ID3)Types of Machine Learnig Algorithms(CART, ID3)
Types of Machine Learnig Algorithms(CART, ID3)
 
A Hierarchical Feature Set optimization for effective code change based Defec...
A Hierarchical Feature Set optimization for effective code change based Defec...A Hierarchical Feature Set optimization for effective code change based Defec...
A Hierarchical Feature Set optimization for effective code change based Defec...
 
Nature-Based Prediction Model of Bug Reports Based on Ensemble Machine Learni...
Nature-Based Prediction Model of Bug Reports Based on Ensemble Machine Learni...Nature-Based Prediction Model of Bug Reports Based on Ensemble Machine Learni...
Nature-Based Prediction Model of Bug Reports Based on Ensemble Machine Learni...
 
An enhanced kernel weighted collaborative recommended system to alleviate spa...
An enhanced kernel weighted collaborative recommended system to alleviate spa...An enhanced kernel weighted collaborative recommended system to alleviate spa...
An enhanced kernel weighted collaborative recommended system to alleviate spa...
 
Algorithm ExampleFor the following taskUse the random module .docx
Algorithm ExampleFor the following taskUse the random module .docxAlgorithm ExampleFor the following taskUse the random module .docx
Algorithm ExampleFor the following taskUse the random module .docx
 
Low rank models for recommender systems with limited preference information
Low rank models for recommender systems with limited preference informationLow rank models for recommender systems with limited preference information
Low rank models for recommender systems with limited preference information
 
slides-sd
slides-sdslides-sd
slides-sd
 
LCBM: Statistics-Based Parallel Collaborative Filtering
LCBM: Statistics-Based Parallel Collaborative FilteringLCBM: Statistics-Based Parallel Collaborative Filtering
LCBM: Statistics-Based Parallel Collaborative Filtering
 
EFFECTIVE IMPLEMENTATION OF AGILE PRACTICES – OBJECT ORIENTED METRICS TOOL TO...
EFFECTIVE IMPLEMENTATION OF AGILE PRACTICES – OBJECT ORIENTED METRICS TOOL TO...EFFECTIVE IMPLEMENTATION OF AGILE PRACTICES – OBJECT ORIENTED METRICS TOOL TO...
EFFECTIVE IMPLEMENTATION OF AGILE PRACTICES – OBJECT ORIENTED METRICS TOOL TO...
 
Revisiting the Notion of Diversity in Software Testing
Revisiting the Notion of Diversity in Software TestingRevisiting the Notion of Diversity in Software Testing
Revisiting the Notion of Diversity in Software Testing
 
Anomaly Detection in Temporal data Using Kmeans Clustering with C5.0
Anomaly Detection in Temporal data Using Kmeans Clustering with C5.0Anomaly Detection in Temporal data Using Kmeans Clustering with C5.0
Anomaly Detection in Temporal data Using Kmeans Clustering with C5.0
 
DSUS_MAO_2012_Jie
DSUS_MAO_2012_JieDSUS_MAO_2012_Jie
DSUS_MAO_2012_Jie
 

More from Yann-Gaël Guéhéneuc

Advice for writing a NSERC Discovery grant application v0.5
Advice for writing a NSERC Discovery grant application v0.5Advice for writing a NSERC Discovery grant application v0.5
Advice for writing a NSERC Discovery grant application v0.5Yann-Gaël Guéhéneuc
 
Ptidej Architecture, Design, and Implementation in Action v2.1
Ptidej Architecture, Design, and Implementation in Action v2.1Ptidej Architecture, Design, and Implementation in Action v2.1
Ptidej Architecture, Design, and Implementation in Action v2.1Yann-Gaël Guéhéneuc
 
Evolution and Examples of Java Features, from Java 1.7 to Java 22
Evolution and Examples of Java Features, from Java 1.7 to Java 22Evolution and Examples of Java Features, from Java 1.7 to Java 22
Evolution and Examples of Java Features, from Java 1.7 to Java 22Yann-Gaël Guéhéneuc
 
Consequences and Principles of Software Quality v0.3
Consequences and Principles of Software Quality v0.3Consequences and Principles of Software Quality v0.3
Consequences and Principles of Software Quality v0.3Yann-Gaël Guéhéneuc
 
Some Pitfalls with Python and Their Possible Solutions v0.9
Some Pitfalls with Python and Their Possible Solutions v0.9Some Pitfalls with Python and Their Possible Solutions v0.9
Some Pitfalls with Python and Their Possible Solutions v0.9Yann-Gaël Guéhéneuc
 
An Explanation of the Unicode, the Text Encoding Standard, Its Usages and Imp...
An Explanation of the Unicode, the Text Encoding Standard, Its Usages and Imp...An Explanation of the Unicode, the Text Encoding Standard, Its Usages and Imp...
An Explanation of the Unicode, the Text Encoding Standard, Its Usages and Imp...Yann-Gaël Guéhéneuc
 
An Explanation of the Halting Problem and Its Consequences
An Explanation of the Halting Problem and Its ConsequencesAn Explanation of the Halting Problem and Its Consequences
An Explanation of the Halting Problem and Its ConsequencesYann-Gaël Guéhéneuc
 
Informaticien(ne)s célèbres (v1.0.2, 19/02/20)
Informaticien(ne)s célèbres (v1.0.2, 19/02/20)Informaticien(ne)s célèbres (v1.0.2, 19/02/20)
Informaticien(ne)s célèbres (v1.0.2, 19/02/20)Yann-Gaël Guéhéneuc
 
On Java Generics, History, Use, Caveats v1.1
On Java Generics, History, Use, Caveats v1.1On Java Generics, History, Use, Caveats v1.1
On Java Generics, History, Use, Caveats v1.1Yann-Gaël Guéhéneuc
 
On Reflection in OO Programming Languages v1.6
On Reflection in OO Programming Languages v1.6On Reflection in OO Programming Languages v1.6
On Reflection in OO Programming Languages v1.6Yann-Gaël Guéhéneuc
 

More from Yann-Gaël Guéhéneuc (20)

Advice for writing a NSERC Discovery grant application v0.5
Advice for writing a NSERC Discovery grant application v0.5Advice for writing a NSERC Discovery grant application v0.5
Advice for writing a NSERC Discovery grant application v0.5
 
Ptidej Architecture, Design, and Implementation in Action v2.1
Ptidej Architecture, Design, and Implementation in Action v2.1Ptidej Architecture, Design, and Implementation in Action v2.1
Ptidej Architecture, Design, and Implementation in Action v2.1
 
Evolution and Examples of Java Features, from Java 1.7 to Java 22
Evolution and Examples of Java Features, from Java 1.7 to Java 22Evolution and Examples of Java Features, from Java 1.7 to Java 22
Evolution and Examples of Java Features, from Java 1.7 to Java 22
 
Consequences and Principles of Software Quality v0.3
Consequences and Principles of Software Quality v0.3Consequences and Principles of Software Quality v0.3
Consequences and Principles of Software Quality v0.3
 
Some Pitfalls with Python and Their Possible Solutions v0.9
Some Pitfalls with Python and Their Possible Solutions v0.9Some Pitfalls with Python and Their Possible Solutions v0.9
Some Pitfalls with Python and Their Possible Solutions v0.9
 
An Explanation of the Unicode, the Text Encoding Standard, Its Usages and Imp...
An Explanation of the Unicode, the Text Encoding Standard, Its Usages and Imp...An Explanation of the Unicode, the Text Encoding Standard, Its Usages and Imp...
An Explanation of the Unicode, the Text Encoding Standard, Its Usages and Imp...
 
An Explanation of the Halting Problem and Its Consequences
An Explanation of the Halting Problem and Its ConsequencesAn Explanation of the Halting Problem and Its Consequences
An Explanation of the Halting Problem and Its Consequences
 
Are CPUs VMs Like Any Others? v1.0
Are CPUs VMs Like Any Others? v1.0Are CPUs VMs Like Any Others? v1.0
Are CPUs VMs Like Any Others? v1.0
 
Informaticien(ne)s célèbres (v1.0.2, 19/02/20)
Informaticien(ne)s célèbres (v1.0.2, 19/02/20)Informaticien(ne)s célèbres (v1.0.2, 19/02/20)
Informaticien(ne)s célèbres (v1.0.2, 19/02/20)
 
Well-known Computer Scientists v1.0.2
Well-known Computer Scientists v1.0.2Well-known Computer Scientists v1.0.2
Well-known Computer Scientists v1.0.2
 
On Java Generics, History, Use, Caveats v1.1
On Java Generics, History, Use, Caveats v1.1On Java Generics, History, Use, Caveats v1.1
On Java Generics, History, Use, Caveats v1.1
 
On Reflection in OO Programming Languages v1.6
On Reflection in OO Programming Languages v1.6On Reflection in OO Programming Languages v1.6
On Reflection in OO Programming Languages v1.6
 
ICSOC'21
ICSOC'21ICSOC'21
ICSOC'21
 
Vissoft21.ppt
Vissoft21.pptVissoft21.ppt
Vissoft21.ppt
 
Service computation20.ppt
Service computation20.pptService computation20.ppt
Service computation20.ppt
 
Serp4 iot20.ppt
Serp4 iot20.pptSerp4 iot20.ppt
Serp4 iot20.ppt
 
Msr20.ppt
Msr20.pptMsr20.ppt
Msr20.ppt
 
Iwesep19.ppt
Iwesep19.pptIwesep19.ppt
Iwesep19.ppt
 
Icsoc20.ppt
Icsoc20.pptIcsoc20.ppt
Icsoc20.ppt
 
Icsoc18.ppt
Icsoc18.pptIcsoc18.ppt
Icsoc18.ppt
 

Recently uploaded

Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceanilsa9823
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 

Recently uploaded (20)

Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 

Bayesian Approach for Detecting Code and Design Smells

  • 1. Foutse Khomh, Stéphane Vaucher, Yann-Gaël Guéhéneuc, and Houari Sahraoui © Khomh, 2009 Ptidej Team – Pattern-based Quality Evaluation and Enhancement Department of Computer Engineering and Software Engineering École Polytechnique de Montréal, Québec, Canada A Bayesian Approach for the Detection of Code and Design Smells QSIC’09 Jeju-do 2009/08/25
  • 2. 2/27 Outline Motivation Context Problems and Objectives Previous Work Our Solution Bayesian Belief Networks Experiments Discussions Conclusion
  • 3. 3/27 Motivation Independent IV&V team reviews of object-oriented software programs – Assess the quality of programs – Identify potential problems • Defects • Anomalies • “Bad Smells”
  • 4. 4/27 Context Code smells and antipatterns Blob: also called God class [23], is a class that centralises functionality and has too many responsibilities. Brown et al. [4] characterise its structure as a large controller class that depends on data stored in several surrounding data classes
  • 5. 5/27 Problems and Objectives Problem 1: Sizes of programs can be large Automate the evaluation process Problem 2: Resources are limited Prioritise manual reviews Problem 3: Quality assessment is subjective Consider uncertainty in the process
  • 6. 6/27 Previous Work (1/2) Webster’s book on “antipatterns” [31] Riel’s 61 heuristics [23] Beck’s 22 code smells [11] Brown et al. 40 antipatterns [4] Travassos et al. manual approach [28] Marinescu’s detection strategies [17] (also Munro [19]) Moha et al. rules cards in DECOR [18]
  • 7. 7/27 Previous Work (2/2) Either no full automation – Problem 1 is not solved Or strict rules with classes participating or not (binary value) to an antipattern – Problem 2 and 3 are not solved
  • 8. 8/27 Our Solution (1/2) Assign a probability that a class is considered an antipattern by a stakeholder Guide a manual inspection according to this probability Use Bayesian belief network to build a model of an antipattern and assign a probability to all classes
  • 9. 9/27 Our Solution (2/2) Problem 1: Sizes of programs can be large Assign a probability to all classes of interest automatically Problem 2: Resources are limited Prioritise manual reviews using probabilities Problem 3: Quality assessment is subjective Uncertainty is naturally considered using Bayesian beliefs networks
  • 10. 10/27 BBN (1/3) A Bayesian Belief Network is a directed acyclic graph with probability distribution Graph structure – Nodes = random variables – Edges = probabilities dependencies Each node depends only on its parents Embody the experts’ knowledge
  • 11. 11/27 BBN (2/3) Classifier – C = {smell, not smell} Input vector describing a class – <a1, …, an> – P(A|B) = P(B|A) P(A) / P(B)
  • 12. 12/27 BBN (2/3) Building a BBN 1. Define its structure 2. Assign/learn its probability tables
  • 13. 13/27 1. Defining the BBN Structure Based on Moha et al.’s rule cards – Detection relies on metrics, binary class relations, and linguistic analysis – Values are combined using set operators – Thresholds are statistically defined (using a box plot)
  • 14. 14/27 Rule Card of Blob RULE_CARD : Blob { RULE : Blob { ASSOC : a s s o c i a t e d FROM : m ai n Cl a ss ONE TO : D a t a C l a s s MANY } ; RULE : MainClass { UNION LargeCla ssLowCohesion C o n t r o l l e r C l a s s } ; RULE : LargeCla ssLo wCohesion { UNION L a r g e C l a s s LowCohesion } ; RULE : L a r g e C l a s s { ( METRIC : NMD + NAD, VERY_HIGH , 0 ) } ; RULE : LowCohesion { ( METRIC : LCOM5, VERY_HIGH , 2 0 ) } ; RULE : C o n t r o l l e r C l a s s { UNION ( SEMANTIC : METHODNAME , { P r o c e s s , C o n t r o l , C t r l , Command , Cmd, Proc, UI, Manage, D r i v e } ) ( SEMANTIC : CLASSNAME , { P r o c e s s , C o n t r o l , C t r l , Command , Cmd, Proc , UI, Manage, Drive , System, Subsystem } ) } ; RULE : D a t a C l a s s { ( STRUCT : METHOD_ACCESSOR , 9 0 ) } ; };
  • 15. 15/27 Conversion into BBN Set operators (OR, AND) are learned using conditional probabilities Hard thresholds and rules are smoothed by interpolating values Binary class relations are counted and treated as metrics
  • 17. 17/27 2. Resulting BBN for the Blob
  • 18. 18/27 Experiments RQ1: To what extent a model built with a BBN based on an existing rule-based model is able detect smells in a program? RQ2: Is a model built with a BBN better than a state-of-the-art approach, DECOR?
  • 19. 19/27 Settings Programs – Xerces v2.7.0 – Gantt Project v1.10.2 Oracle: Vote of three groups (of students) on both programs
  • 20. 20/27 Settings Calibration (probability tables) – Local (same-system calibration) – External (calibrated on one system, applied to the other)
  • 21. 21/27 Local calibration On Xerces only Three-fold cross validation – 3 groups with 5 Blobs in each – Combination of 2 groups for calibration, tested on the other Inspected Classes Group1 6 Group2 7 Group3 9 Waste of 8% to 44% of effort (average 32%)
  • 22. 22/27 External calibration Probabilities learned on one, applied on other Precision vs. Recall (per investigation sizes) Xerces (left), Gantt (right)
  • 23. 23/27 Experiments RQ1: To what extent a model built with a BBN based on an existing rule-based model is able detect smells in a program? RQ2: Is a model built with a BBN better than a state-of-the-art approach, DECOR? Better than DECOR
  • 24. 24/27 Discussions (1/2) Results of BBN are superior to those of DECOR External calibration yields good results even though tweaking is recommended A well calibrated model should be able to estimate the number of smells in a program, but our models overestimate by a factor of 2
  • 25. 25/27 Discussions (2/2) Used simple techniques to convert rules into probability distributions Worked with discrete probabilities, might need to be adapted to continuous cases
  • 26. 26/27 Conclusion Bayesian models support uncertainty in detection process Their performance is better than state- of-the-art rules External calibration seems to indicate that this could be used in an industrial context with minimal costs Support for automated conversion of rules to support more design smells
  • 27. 27/27 Acknowledgements Naouel Moha for providing her data and code to compare with DECOR Natural Sciences and Engineering Research Council of Canada Canada Research Chair in Software Patterns and Patterns of Software
  • 28. 28/27 Advertisement IEEE Software Special issue on Software Evolution Deadline: 1st of November, 2009 Publication: July/August 2010 Please do not hesitate to contact me! ☺