SlideShare a Scribd company logo
1 of 22
Download to read offline
Olivier Kaczor, Yann-Gaël Guéhéneuc and Sylvie Hamel
{kaczorol, guehene, hamelsyl}@iro.umontreal.ca
© Olivier Kaczor 2006
GEODES qnd LBIT
Department of Informatics and Operations Research
University of Montreal
GEODES
Efficient Identification of Design
Patterns with Bit-vector Algorithm
2/22
Outline
1. Introduction
2. Related Work
3. Our Approach:
1. Code source transformation
2. Identification with Bit-vector algorithm
4. Case Study
5. Current and Future Work
3/22
Design patterns:
Provide good solutions to recurring design problems
Provide design vocabulary to improve communication
Encourage designs re-use
Auto document the source code
“Design patterns help a designer get a design "right" faster”
[Gamma and al. 1994]
1. Introduction (1/2)
4/22
Why detect design motifs:
Measure the quality of a system
Help document the source code
Help understand the design problems and choices
Sub-problem: Identify micro-architectures similar to design motifs
Program model rarely reflects a design motif completely
Help to improve the code by applying corrections based on the
design motifs
What is a design motif occurrence?
An occurrence is a micro-architecture where each role of the design
motif is played by only one entity
1. Introduction (2/2)
5/22
Some known identification techniques:
– Logic programming [Kramer-Prechelt 1996, Wuyts 1998]
– Constraints programming with explanations [Guéhéneuc-Jussien 2001]
– Fuzzy logic [Jahnke and al. 1997, Niere and al. 2001]
– Graphs transformation [Smolarova-Kadlec 2000]
General problem: limited performance
2. Related Work (1/3)
6/22
Metrics to improve efficiency [Antoniol and al. 1998, Guéhéneuc and al. 2004]
Idea : Reduce the search space by removing entities which obviously do not
participate in a design motif according to expected metrics values
1. Create fingerprints of design patterns roles with internal attributes of classes playing
those roles
2. Use those fingerprints to create identification rules
Multi-stage-filtering:
Metrics
evaluations
Other
evaluations
Structural
evaluations
A B C D
D ≤ C ≤ B ≤ A
2. Related Work (2/3)
7/22
Similar problem in bioinformatics:
– Localising mutated (or not) genes in long anonymous DNA
sequences
– Localising modified (or not) proteins in long amino-acid sequences
Solutions adopted in bioinformatics:
– Vector algorithms [Myers 1997, Bergeron-Hamel 2002]
– Automata simulation [Holub 1997]
– Dynamic programming alignment [Needleman-Wunsch 1970, Smith-
Waterman 1981]
2. Related Work (3/3)
8/22
Design patterns detection system:
Source Code Results
Source Code
Transformation
Detection
Algorithm
Design
Patterns
Detection
9/22
Problem:
Bioinformatics algorithms work on strings
Program and design motifs models must be converted in
strings
3. Our approach: Source code transformation (1/3)
Solution:
Program and design motifs models can be seen as directed
graphs
Build their string representations by going through every edge
in their graphs
10/22
Steps to obtain the string representations:
1. Transform the graphs into Eulerian graphs:
– Build an adjacency matrix to identify vertices with unequal in-degree and
out-degree
– Compute an optimal list of flows to be added between those vertices with
the transportation simplex
Composite
+remove( c : Component )
+add( c : Component )
+getChild( i : int )
+operation()+operation()
Leaf
+operation()
ComponentClient coas
in in
Composite
+remove( c : Component )
+add( c : Component )
+getChild( i : int )
+operation()+operation()
Leaf
+operation()
ComponentClient coas
dm
in in
3. Our approach: Source code transformation (2/3)
001Composite
000Leaf
110Component
CompositeLeafComponentinout
Leaf: out-degree: 0
in-degree: 1
11/22
Steps to obtain the string representations:
2. Find an Eulerian circuit and build the strings:
– Resolve the directed Chinese Postman Problem to find the shortest tour of
the graphs (an Eulerian circuit)
– Build the strings by running through the circuits
Composite
+remove( c : Component )
+add( c : Component )
+getChild( i : int )
+operation()+operation()
Leaf
+operation()
ComponentClient coas
dm
in in
3. Our approach: Source code transformation (3/3)
ComponentComponent in LeafComponent in Leaf dm ComponentComponent in Leaf dm Component in CompositeComponent in Leaf dm Component in Composite co Component
12/22
Problem: The design motif string is more like a regular expression
than a word
Solution: Iterative bit-vector algorithm
Objective:
3. Our approach: Identification algorithm (1/6)
Vector
Algorithm
13/22
Let x = x1x2…xm be a string representing a program model and c a symbol in
that string
We define the characteristic vector of c associated to the string x to be:
3. Our approach: Identification algorithm (2/6)
Characteristic vectors are circular sequences of bits on which we operate
with standard bit operations:
• and
• or
• left shift
• right shift
• etc.
14/22
3. Our approach: Identification algorithm (3/6)
A in B in D dm B in E co B in C dm G cr C dm G cr D dm G cr E dm G as F ag A
Example:
15/22
We match against each other the two strings to build a list of potential
occurrences
The algorithm reads triplets of tokens in the design motif string and
associates program entities to the roles
3. Our approach: Identification algorithm (4/6)
We retrieve entities before and after an in token in the program string with
bit-wise operations on the characteristic vectors to have potential entities
for the Component and Leaf roles
For example:
16/22
We search for entities after a
Component entity and an in relationship
(ex: B in Composite)
3. Our approach: Identification algorithm (5/6)
EEB
DEB
CEB
EDB
DDB
CDB
ECBEB
EEBDCBDB
EDBCCBCB
ECBBBABA
Fourth (co)Third (in)First (in)
Triplets
Component
Leaf
Composite
Component
Component
Leaf
Leaf
Composite
Occurrences after processing
the first third and fourth triplets
17/22
3. Our approach: Identification algorithm (6/6)
A program model rarely reflects a design motif completely
We include automatic and manual approximation mechanisms
1. Association relationships:
– Composition, aggregation, association and use relationship
– Conjunction of characteristic vectors
2. Entity counts
– Ex: A Composite without leaf
– Triplets can be overlooked
3. Inheritance relationship:
– Some entities could be inserted or removed from a hierarchy
– Parent and children of a class are also possible entities for a role
18/22
We applied our algorithm on 3 public domain software:
1. Juzzle v0.5
2. JHotDraw v5.1
3. QuickUML 2001
We used an AMD Athlon at 2Ghz with 1024 Mb RAM
4. Case Study (1/3)
149373QuickUML 2001
37261JHotDraw v5.1
599Juzzle v0.5
Computation timesSizesPrograms
Computation times (in seconds) for building the string representation
19/22
4. Case Study (2/3)
Identification times (in seconds) of design
motifs with all approximations
We compared our bit-vector technique with Ptidej, a framework implementing:
Explanation-based constraint programming
Metric-enhanced explanation-based constraint programming
2718526514+∞QuickUML 2001
0.30.5345Juzzle v0.5
2512917362+∞JHotDraw v5.1
Composite
2997153785QuickUML 2001
0.30.921Juzzle v0.5
272182751202JHotDraw v5.1
Abstract Factory
BV+OBVCP+MCP
20/22
4. Case Study (3/3)
Number of identified occurrences of the design motifs
5134743N/A00N/A22QuickUML 2001
00200000Juzzle v0.5
60916983N/A00N/A70JHotDraw v5.1
Composite
11812459357235713QuickUML 2001
13090000Juzzle v0.5
1948492994221692210JHotDraw v5.1
Abstract Factory
BVCP+MCPBVCP+MCP
ApproximateExact
Existing
Occurrences
21/22
Improve the precision of the results
– Combine bit-vector algorithms with empirical metrics values
– Add negative relationships in design motifs
– Add dynamic information in the string representations
Try the approach on more and bigger software
Try other bioinformatics string matching algorithms
5. Current and Future Work
Efficient Design Pattern Detection

More Related Content

What's hot

Hybrid ga svm for efficient feature selection in e-mail classification
Hybrid ga svm for efficient feature selection in e-mail classificationHybrid ga svm for efficient feature selection in e-mail classification
Hybrid ga svm for efficient feature selection in e-mail classificationAlexander Decker
 
11.hybrid ga svm for efficient feature selection in e-mail classification
11.hybrid ga svm for efficient feature selection in e-mail classification11.hybrid ga svm for efficient feature selection in e-mail classification
11.hybrid ga svm for efficient feature selection in e-mail classificationAlexander Decker
 
An effective approach to offline arabic handwriting recognition
An effective approach to offline arabic handwriting recognitionAn effective approach to offline arabic handwriting recognition
An effective approach to offline arabic handwriting recognitionijaia
 
Facial Image Analysis for age and gender and
Facial Image Analysis for age and gender andFacial Image Analysis for age and gender and
Facial Image Analysis for age and gender andYuheng Wang
 
A bidirectional text transcription of braille for odia, hindi, telugu and eng...
A bidirectional text transcription of braille for odia, hindi, telugu and eng...A bidirectional text transcription of braille for odia, hindi, telugu and eng...
A bidirectional text transcription of braille for odia, hindi, telugu and eng...eSAT Journals
 
Applications of Pattern Recognition Algorithms in Agriculture: A Review
Applications of Pattern Recognition Algorithms in Agriculture: A ReviewApplications of Pattern Recognition Algorithms in Agriculture: A Review
Applications of Pattern Recognition Algorithms in Agriculture: A ReviewEswar Publications
 
Representation and recognition of handwirten digits using deformable templates
Representation and recognition of handwirten digits using deformable templatesRepresentation and recognition of handwirten digits using deformable templates
Representation and recognition of handwirten digits using deformable templatesAhmed Abd-Elwasaa
 
BrailleOCR: An Open Source Document to Braille Converter Application
BrailleOCR: An Open Source Document to Braille Converter ApplicationBrailleOCR: An Open Source Document to Braille Converter Application
BrailleOCR: An Open Source Document to Braille Converter Applicationpijush15
 
HANDWRITTEN DIGIT RECOGNITION USING k-NN CLASSIFIER
HANDWRITTEN DIGIT RECOGNITION USING k-NN CLASSIFIERHANDWRITTEN DIGIT RECOGNITION USING k-NN CLASSIFIER
HANDWRITTEN DIGIT RECOGNITION USING k-NN CLASSIFIERvineet raj
 
IRJET- Object Detection using Hausdorff Distance
IRJET-  	  Object Detection using Hausdorff DistanceIRJET-  	  Object Detection using Hausdorff Distance
IRJET- Object Detection using Hausdorff DistanceIRJET Journal
 
Transcription Factor DNA Binding Prediction
Transcription Factor DNA Binding PredictionTranscription Factor DNA Binding Prediction
Transcription Factor DNA Binding PredictionUT, San Antonio
 
Self-Directing Text Detection and Removal from Images with Smoothing
Self-Directing Text Detection and Removal from Images with SmoothingSelf-Directing Text Detection and Removal from Images with Smoothing
Self-Directing Text Detection and Removal from Images with SmoothingPriyanka Wagh
 
Multi biometric cryptosystems based on feature-level fusion
Multi biometric cryptosystems based on feature-level fusionMulti biometric cryptosystems based on feature-level fusion
Multi biometric cryptosystems based on feature-level fusionParag Tamhane
 
­­­­Cursive Handwriting Recognition System using Feature Extraction and Artif...
­­­­Cursive Handwriting Recognition System using Feature Extraction and Artif...­­­­Cursive Handwriting Recognition System using Feature Extraction and Artif...
­­­­Cursive Handwriting Recognition System using Feature Extraction and Artif...IRJET Journal
 
A Novel Design For Generating Dynamic Length Message Digest To Ensure Integri...
A Novel Design For Generating Dynamic Length Message Digest To Ensure Integri...A Novel Design For Generating Dynamic Length Message Digest To Ensure Integri...
A Novel Design For Generating Dynamic Length Message Digest To Ensure Integri...IRJET Journal
 
A NOVEL APPROACH FOR GENERATING FACE TEMPLATE USING BDA
A NOVEL APPROACH FOR GENERATING FACE TEMPLATE USING BDAA NOVEL APPROACH FOR GENERATING FACE TEMPLATE USING BDA
A NOVEL APPROACH FOR GENERATING FACE TEMPLATE USING BDAcsandit
 
Introduction to image processing and pattern recognition
Introduction to image processing and pattern recognitionIntroduction to image processing and pattern recognition
Introduction to image processing and pattern recognitionSaibee Alam
 
SE-IT JAVA LAB SYLLABUS
SE-IT JAVA LAB SYLLABUSSE-IT JAVA LAB SYLLABUS
SE-IT JAVA LAB SYLLABUSnikshaikh786
 

What's hot (18)

Hybrid ga svm for efficient feature selection in e-mail classification
Hybrid ga svm for efficient feature selection in e-mail classificationHybrid ga svm for efficient feature selection in e-mail classification
Hybrid ga svm for efficient feature selection in e-mail classification
 
11.hybrid ga svm for efficient feature selection in e-mail classification
11.hybrid ga svm for efficient feature selection in e-mail classification11.hybrid ga svm for efficient feature selection in e-mail classification
11.hybrid ga svm for efficient feature selection in e-mail classification
 
An effective approach to offline arabic handwriting recognition
An effective approach to offline arabic handwriting recognitionAn effective approach to offline arabic handwriting recognition
An effective approach to offline arabic handwriting recognition
 
Facial Image Analysis for age and gender and
Facial Image Analysis for age and gender andFacial Image Analysis for age and gender and
Facial Image Analysis for age and gender and
 
A bidirectional text transcription of braille for odia, hindi, telugu and eng...
A bidirectional text transcription of braille for odia, hindi, telugu and eng...A bidirectional text transcription of braille for odia, hindi, telugu and eng...
A bidirectional text transcription of braille for odia, hindi, telugu and eng...
 
Applications of Pattern Recognition Algorithms in Agriculture: A Review
Applications of Pattern Recognition Algorithms in Agriculture: A ReviewApplications of Pattern Recognition Algorithms in Agriculture: A Review
Applications of Pattern Recognition Algorithms in Agriculture: A Review
 
Representation and recognition of handwirten digits using deformable templates
Representation and recognition of handwirten digits using deformable templatesRepresentation and recognition of handwirten digits using deformable templates
Representation and recognition of handwirten digits using deformable templates
 
BrailleOCR: An Open Source Document to Braille Converter Application
BrailleOCR: An Open Source Document to Braille Converter ApplicationBrailleOCR: An Open Source Document to Braille Converter Application
BrailleOCR: An Open Source Document to Braille Converter Application
 
HANDWRITTEN DIGIT RECOGNITION USING k-NN CLASSIFIER
HANDWRITTEN DIGIT RECOGNITION USING k-NN CLASSIFIERHANDWRITTEN DIGIT RECOGNITION USING k-NN CLASSIFIER
HANDWRITTEN DIGIT RECOGNITION USING k-NN CLASSIFIER
 
IRJET- Object Detection using Hausdorff Distance
IRJET-  	  Object Detection using Hausdorff DistanceIRJET-  	  Object Detection using Hausdorff Distance
IRJET- Object Detection using Hausdorff Distance
 
Transcription Factor DNA Binding Prediction
Transcription Factor DNA Binding PredictionTranscription Factor DNA Binding Prediction
Transcription Factor DNA Binding Prediction
 
Self-Directing Text Detection and Removal from Images with Smoothing
Self-Directing Text Detection and Removal from Images with SmoothingSelf-Directing Text Detection and Removal from Images with Smoothing
Self-Directing Text Detection and Removal from Images with Smoothing
 
Multi biometric cryptosystems based on feature-level fusion
Multi biometric cryptosystems based on feature-level fusionMulti biometric cryptosystems based on feature-level fusion
Multi biometric cryptosystems based on feature-level fusion
 
­­­­Cursive Handwriting Recognition System using Feature Extraction and Artif...
­­­­Cursive Handwriting Recognition System using Feature Extraction and Artif...­­­­Cursive Handwriting Recognition System using Feature Extraction and Artif...
­­­­Cursive Handwriting Recognition System using Feature Extraction and Artif...
 
A Novel Design For Generating Dynamic Length Message Digest To Ensure Integri...
A Novel Design For Generating Dynamic Length Message Digest To Ensure Integri...A Novel Design For Generating Dynamic Length Message Digest To Ensure Integri...
A Novel Design For Generating Dynamic Length Message Digest To Ensure Integri...
 
A NOVEL APPROACH FOR GENERATING FACE TEMPLATE USING BDA
A NOVEL APPROACH FOR GENERATING FACE TEMPLATE USING BDAA NOVEL APPROACH FOR GENERATING FACE TEMPLATE USING BDA
A NOVEL APPROACH FOR GENERATING FACE TEMPLATE USING BDA
 
Introduction to image processing and pattern recognition
Introduction to image processing and pattern recognitionIntroduction to image processing and pattern recognition
Introduction to image processing and pattern recognition
 
SE-IT JAVA LAB SYLLABUS
SE-IT JAVA LAB SYLLABUSSE-IT JAVA LAB SYLLABUS
SE-IT JAVA LAB SYLLABUS
 

Similar to Efficient Design Pattern Detection

Generic Model-based Approaches for Software Reverse Engineering and Comprehen...
Generic Model-based Approaches for Software Reverse Engineering and Comprehen...Generic Model-based Approaches for Software Reverse Engineering and Comprehen...
Generic Model-based Approaches for Software Reverse Engineering and Comprehen...Hugo Bruneliere
 
Questions On The Equation For Regression
Questions On The Equation For RegressionQuestions On The Equation For Regression
Questions On The Equation For RegressionTiffany Sandoval
 
Web Information Extraction Learning based on Probabilistic Graphical Models
Web Information Extraction Learning based on Probabilistic Graphical ModelsWeb Information Extraction Learning based on Probabilistic Graphical Models
Web Information Extraction Learning based on Probabilistic Graphical ModelsGUANBO
 
2014 01-ticosa
2014 01-ticosa2014 01-ticosa
2014 01-ticosaPharo
 
SADP PPTs of all modules - Shanthi D.L.pdf
SADP PPTs of all modules - Shanthi D.L.pdfSADP PPTs of all modules - Shanthi D.L.pdf
SADP PPTs of all modules - Shanthi D.L.pdfB.T.L.I.T
 
Characterization of a 2D Geometry Using C++ Interface
Characterization of a 2D Geometry Using C++ InterfaceCharacterization of a 2D Geometry Using C++ Interface
Characterization of a 2D Geometry Using C++ Interfacedrboon
 
Generation of Random EMF Models for Benchmarks
Generation of Random EMF Models for BenchmarksGeneration of Random EMF Models for Benchmarks
Generation of Random EMF Models for BenchmarksMarkus Scheidgen
 
Software architacture recovery
Software architacture recoverySoftware architacture recovery
Software architacture recoveryImdad Ul Haq
 
Software Engineering with Objects (M363) Final Revision By Kuwait10
Software Engineering with Objects (M363) Final Revision By Kuwait10Software Engineering with Objects (M363) Final Revision By Kuwait10
Software Engineering with Objects (M363) Final Revision By Kuwait10Kuwait10
 
Algorithm Identification In Programming Assignments
Algorithm Identification In Programming AssignmentsAlgorithm Identification In Programming Assignments
Algorithm Identification In Programming AssignmentsKarin Faust
 

Similar to Efficient Design Pattern Detection (20)

CSMR06a.ppt
CSMR06a.pptCSMR06a.ppt
CSMR06a.ppt
 
Generic Model-based Approaches for Software Reverse Engineering and Comprehen...
Generic Model-based Approaches for Software Reverse Engineering and Comprehen...Generic Model-based Approaches for Software Reverse Engineering and Comprehen...
Generic Model-based Approaches for Software Reverse Engineering and Comprehen...
 
MSR Asia Summit
MSR Asia SummitMSR Asia Summit
MSR Asia Summit
 
Questions On The Equation For Regression
Questions On The Equation For RegressionQuestions On The Equation For Regression
Questions On The Equation For Regression
 
Web Information Extraction Learning based on Probabilistic Graphical Models
Web Information Extraction Learning based on Probabilistic Graphical ModelsWeb Information Extraction Learning based on Probabilistic Graphical Models
Web Information Extraction Learning based on Probabilistic Graphical Models
 
2014 01-ticosa
2014 01-ticosa2014 01-ticosa
2014 01-ticosa
 
SADP PPTs of all modules - Shanthi D.L.pdf
SADP PPTs of all modules - Shanthi D.L.pdfSADP PPTs of all modules - Shanthi D.L.pdf
SADP PPTs of all modules - Shanthi D.L.pdf
 
C04701019027
C04701019027C04701019027
C04701019027
 
Characterization of a 2D Geometry Using C++ Interface
Characterization of a 2D Geometry Using C++ InterfaceCharacterization of a 2D Geometry Using C++ Interface
Characterization of a 2D Geometry Using C++ Interface
 
Generation of Random EMF Models for Benchmarks
Generation of Random EMF Models for BenchmarksGeneration of Random EMF Models for Benchmarks
Generation of Random EMF Models for Benchmarks
 
Ase06.ppt
Ase06.pptAse06.ppt
Ase06.ppt
 
MDE in Practice
MDE in PracticeMDE in Practice
MDE in Practice
 
Ase02 dmp.ppt
Ase02 dmp.pptAse02 dmp.ppt
Ase02 dmp.ppt
 
Software architacture recovery
Software architacture recoverySoftware architacture recovery
Software architacture recovery
 
Software Engineering with Objects (M363) Final Revision By Kuwait10
Software Engineering with Objects (M363) Final Revision By Kuwait10Software Engineering with Objects (M363) Final Revision By Kuwait10
Software Engineering with Objects (M363) Final Revision By Kuwait10
 
Algorithm Identification In Programming Assignments
Algorithm Identification In Programming AssignmentsAlgorithm Identification In Programming Assignments
Algorithm Identification In Programming Assignments
 
Assignment-1-NF.docx
Assignment-1-NF.docxAssignment-1-NF.docx
Assignment-1-NF.docx
 
Thesis Giani UIC Slides EN
Thesis Giani UIC Slides ENThesis Giani UIC Slides EN
Thesis Giani UIC Slides EN
 
COMPSAC 2008 Presentation
COMPSAC 2008 PresentationCOMPSAC 2008 Presentation
COMPSAC 2008 Presentation
 
Source Code Summarization
Source Code SummarizationSource Code Summarization
Source Code Summarization
 

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

Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
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
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
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
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
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.
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
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
 
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.
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 

Recently uploaded (20)

Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
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
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
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
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
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 ...
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
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
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
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
 
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...
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 

Efficient Design Pattern Detection

  • 1. Olivier Kaczor, Yann-Gaël Guéhéneuc and Sylvie Hamel {kaczorol, guehene, hamelsyl}@iro.umontreal.ca © Olivier Kaczor 2006 GEODES qnd LBIT Department of Informatics and Operations Research University of Montreal GEODES Efficient Identification of Design Patterns with Bit-vector Algorithm
  • 2. 2/22 Outline 1. Introduction 2. Related Work 3. Our Approach: 1. Code source transformation 2. Identification with Bit-vector algorithm 4. Case Study 5. Current and Future Work
  • 3. 3/22 Design patterns: Provide good solutions to recurring design problems Provide design vocabulary to improve communication Encourage designs re-use Auto document the source code “Design patterns help a designer get a design "right" faster” [Gamma and al. 1994] 1. Introduction (1/2)
  • 4. 4/22 Why detect design motifs: Measure the quality of a system Help document the source code Help understand the design problems and choices Sub-problem: Identify micro-architectures similar to design motifs Program model rarely reflects a design motif completely Help to improve the code by applying corrections based on the design motifs What is a design motif occurrence? An occurrence is a micro-architecture where each role of the design motif is played by only one entity 1. Introduction (2/2)
  • 5. 5/22 Some known identification techniques: – Logic programming [Kramer-Prechelt 1996, Wuyts 1998] – Constraints programming with explanations [Guéhéneuc-Jussien 2001] – Fuzzy logic [Jahnke and al. 1997, Niere and al. 2001] – Graphs transformation [Smolarova-Kadlec 2000] General problem: limited performance 2. Related Work (1/3)
  • 6. 6/22 Metrics to improve efficiency [Antoniol and al. 1998, Guéhéneuc and al. 2004] Idea : Reduce the search space by removing entities which obviously do not participate in a design motif according to expected metrics values 1. Create fingerprints of design patterns roles with internal attributes of classes playing those roles 2. Use those fingerprints to create identification rules Multi-stage-filtering: Metrics evaluations Other evaluations Structural evaluations A B C D D ≤ C ≤ B ≤ A 2. Related Work (2/3)
  • 7. 7/22 Similar problem in bioinformatics: – Localising mutated (or not) genes in long anonymous DNA sequences – Localising modified (or not) proteins in long amino-acid sequences Solutions adopted in bioinformatics: – Vector algorithms [Myers 1997, Bergeron-Hamel 2002] – Automata simulation [Holub 1997] – Dynamic programming alignment [Needleman-Wunsch 1970, Smith- Waterman 1981] 2. Related Work (3/3)
  • 8. 8/22 Design patterns detection system: Source Code Results Source Code Transformation Detection Algorithm Design Patterns Detection
  • 9. 9/22 Problem: Bioinformatics algorithms work on strings Program and design motifs models must be converted in strings 3. Our approach: Source code transformation (1/3) Solution: Program and design motifs models can be seen as directed graphs Build their string representations by going through every edge in their graphs
  • 10. 10/22 Steps to obtain the string representations: 1. Transform the graphs into Eulerian graphs: – Build an adjacency matrix to identify vertices with unequal in-degree and out-degree – Compute an optimal list of flows to be added between those vertices with the transportation simplex Composite +remove( c : Component ) +add( c : Component ) +getChild( i : int ) +operation()+operation() Leaf +operation() ComponentClient coas in in Composite +remove( c : Component ) +add( c : Component ) +getChild( i : int ) +operation()+operation() Leaf +operation() ComponentClient coas dm in in 3. Our approach: Source code transformation (2/3) 001Composite 000Leaf 110Component CompositeLeafComponentinout Leaf: out-degree: 0 in-degree: 1
  • 11. 11/22 Steps to obtain the string representations: 2. Find an Eulerian circuit and build the strings: – Resolve the directed Chinese Postman Problem to find the shortest tour of the graphs (an Eulerian circuit) – Build the strings by running through the circuits Composite +remove( c : Component ) +add( c : Component ) +getChild( i : int ) +operation()+operation() Leaf +operation() ComponentClient coas dm in in 3. Our approach: Source code transformation (3/3) ComponentComponent in LeafComponent in Leaf dm ComponentComponent in Leaf dm Component in CompositeComponent in Leaf dm Component in Composite co Component
  • 12. 12/22 Problem: The design motif string is more like a regular expression than a word Solution: Iterative bit-vector algorithm Objective: 3. Our approach: Identification algorithm (1/6) Vector Algorithm
  • 13. 13/22 Let x = x1x2…xm be a string representing a program model and c a symbol in that string We define the characteristic vector of c associated to the string x to be: 3. Our approach: Identification algorithm (2/6) Characteristic vectors are circular sequences of bits on which we operate with standard bit operations: • and • or • left shift • right shift • etc.
  • 14. 14/22 3. Our approach: Identification algorithm (3/6) A in B in D dm B in E co B in C dm G cr C dm G cr D dm G cr E dm G as F ag A Example:
  • 15. 15/22 We match against each other the two strings to build a list of potential occurrences The algorithm reads triplets of tokens in the design motif string and associates program entities to the roles 3. Our approach: Identification algorithm (4/6) We retrieve entities before and after an in token in the program string with bit-wise operations on the characteristic vectors to have potential entities for the Component and Leaf roles For example:
  • 16. 16/22 We search for entities after a Component entity and an in relationship (ex: B in Composite) 3. Our approach: Identification algorithm (5/6) EEB DEB CEB EDB DDB CDB ECBEB EEBDCBDB EDBCCBCB ECBBBABA Fourth (co)Third (in)First (in) Triplets Component Leaf Composite Component Component Leaf Leaf Composite Occurrences after processing the first third and fourth triplets
  • 17. 17/22 3. Our approach: Identification algorithm (6/6) A program model rarely reflects a design motif completely We include automatic and manual approximation mechanisms 1. Association relationships: – Composition, aggregation, association and use relationship – Conjunction of characteristic vectors 2. Entity counts – Ex: A Composite without leaf – Triplets can be overlooked 3. Inheritance relationship: – Some entities could be inserted or removed from a hierarchy – Parent and children of a class are also possible entities for a role
  • 18. 18/22 We applied our algorithm on 3 public domain software: 1. Juzzle v0.5 2. JHotDraw v5.1 3. QuickUML 2001 We used an AMD Athlon at 2Ghz with 1024 Mb RAM 4. Case Study (1/3) 149373QuickUML 2001 37261JHotDraw v5.1 599Juzzle v0.5 Computation timesSizesPrograms Computation times (in seconds) for building the string representation
  • 19. 19/22 4. Case Study (2/3) Identification times (in seconds) of design motifs with all approximations We compared our bit-vector technique with Ptidej, a framework implementing: Explanation-based constraint programming Metric-enhanced explanation-based constraint programming 2718526514+∞QuickUML 2001 0.30.5345Juzzle v0.5 2512917362+∞JHotDraw v5.1 Composite 2997153785QuickUML 2001 0.30.921Juzzle v0.5 272182751202JHotDraw v5.1 Abstract Factory BV+OBVCP+MCP
  • 20. 20/22 4. Case Study (3/3) Number of identified occurrences of the design motifs 5134743N/A00N/A22QuickUML 2001 00200000Juzzle v0.5 60916983N/A00N/A70JHotDraw v5.1 Composite 11812459357235713QuickUML 2001 13090000Juzzle v0.5 1948492994221692210JHotDraw v5.1 Abstract Factory BVCP+MCPBVCP+MCP ApproximateExact Existing Occurrences
  • 21. 21/22 Improve the precision of the results – Combine bit-vector algorithms with empirical metrics values – Add negative relationships in design motifs – Add dynamic information in the string representations Try the approach on more and bigger software Try other bioinformatics string matching algorithms 5. Current and Future Work