This document presents a recommendation system for design patterns in software development. The system uses a knowledge base of design patterns and a Goal, Question, Metric methodology to ask users a series of weighted questions to determine the most suitable design pattern for their needs. An experiment was conducted with 8 users to evaluate the system. The system was able to correctly recommend a design pattern 50% of the time and was found to require fewer questions than similar existing systems. Future work will focus on expanding the knowledge base and further evaluating the system.
1. Recommendation
System for Design
Patterns in
Software
Development
Outline
Introduction
Recommendation System for Design Patterns
in Software Development
Motivating Scenario
Design Patterns and
Recommendation Systems
Related Work
Methodology
Ingredient: Knowledge Base
e
e e
Francis Palma1,2 , Hadi Farzin1, Yann-Ga¨l Gu´h´neuc1 ,
Naouel Moha2
Ingredient: GQM
Process Summary
Primary Level
Experiment
User Session
1
2
´
Ecole Polytechnique de Montr´al, Canada
e
Universit´ du Qu´bec ` Montr´al, Canada
e
e
a
e
Summary
Comparison
Conclusion
4 June 2012
Pattern Trace Identification, Detection, and Enhancement in Java
SOftware Cost-effective Change and Evolution Research Lab
2. Recommendation
System for Design
Patterns in
Software
Development
Outline
Table of Contents
Introduction
Introduction
Motivating Scenario
Design Patterns and
Recommendation Systems
Related Work
Related Work
Methodology
Ingredient: Knowledge Base
Ingredient: GQM
Methodology
Process Summary
Primary Level
Experiment
User Session
Experiment
Summary
Comparison
Conclusion
2 / 21
Conclusion
3. Recommendation
System for Design
Patterns in
Software
Development
Outline
Table of Contents
Introduction
Introduction
Motivating Scenario
Design Patterns and
Recommendation Systems
Related Work
Related Work
Methodology
Ingredient: Knowledge Base
Ingredient: GQM
Methodology
Process Summary
Primary Level
Experiment
User Session
Experiment
Summary
Comparison
Conclusion
3 / 21
Conclusion
4. Recommendation
System for Design
Patterns in
Software
Development
Introduction
Motivating Scenario
First Scenario (Assumption 1)
Outline
Not reusable
Introduction
Motivating Scenario
Expensive maintenance life
Design Patterns and
Recommendation Systems
Poor performance/antipatterns
Related Work
Methodology
Ingredient: Knowledge Base
Ingredient: GQM
Process Summary
Primary Level
Experiment
User Session
Summary
Comparison
Conclusion
4 / 21
Designer
Developer
Produced System
Hard for comprehension
Low maintainability
Hard for evolution
5. Recommendation
System for Design
Patterns in
Software
Development
Introduction
Motivating Scenario
First Scenario (Assumption 1)
Outline
Not reusable
Introduction
Motivating Scenario
Expensive maintenance life
Design Patterns and
Recommendation Systems
Poor performance/antipatterns
Related Work
Designer
Developer
Produced System
Methodology
Ingredient: Knowledge Base
Hard for comprehension
Low maintainability
Hard for evolution
Ingredient: GQM
Process Summary
Primary Level
Experiment
User Session
Second Scenario (Assumption 2)
Recommended Design Pattern
Summary
Comparison
Reusable in a new problem
Low cost maintenance
Conclusion
Good performance, no/less antipatterns
Designer
4 / 21
Developer
Produced System
Easy for comprehension
High maintainability
Easy for evolution
6. Recommendation
System for Design
Patterns in
Software
Development
Outline
Introduction
Introduction
Design Patterns and Recommendation Systems
Design Patterns?
◮
Motivating Scenario
Design Patterns and
Recommendation Systems
“Descriptions of communicating objects and classes that
are customized to solve a general design problem in a
particular context.” [Gamma et al.]
◮
Related Work
Methodology
Ingredient: Knowledge Base
◮
Ingredient: GQM
◮
Process Summary
Increased reusability, improved maintainability and
comprehensibility
Increasing number of DPs → Better quality
Inappropriate use → Complexity
Primary Level
Experiment
User Session
Recommendation Systems
Summary
Comparison
◮
Conclusion
◮
5 / 21
Recommendation systems → Information filtering
systems
Collaborative, content-based filtering (primary level)
and Hybrid (secondary level)
7. Recommendation
System for Design
Patterns in
Software
Development
Introduction
Outline
Introduction
Our Goal
Motivating Scenario
Design Patterns and
Recommendation Systems
Related Work
◮
◮
Methodology
Ingredient: Knowledge Base
The purpose of our work is to propose a Design
Pattern Recommender (DPR) system
Help designers by minimizing their effort to choose
design patterns
Ingredient: GQM
Process Summary
Primary Level
Experiment
◮
Our solution is two-fold
◮
User Session
Summary
Comparison
Conclusion
6 / 21
◮
Recommend a design pattern for a context
(primary-level)
Recommend one(more) design pattern(s) for a system
given its initial design (secondary-level, future work)
8. Recommendation
System for Design
Patterns in
Software
Development
Outline
Table of Contents
Introduction
Introduction
Motivating Scenario
Design Patterns and
Recommendation Systems
Related Work
Related Work
Methodology
Ingredient: Knowledge Base
Ingredient: GQM
Methodology
Process Summary
Primary Level
Experiment
User Session
Experiment
Summary
Comparison
Conclusion
7 / 21
Conclusion
9. Recommendation
System for Design
Patterns in
Software
Development
Related Work
ReBuilder [1]
Outline
◮
Introduction
Motivating Scenario
Design Patterns and
Recommendation Systems
◮
◮
Related Work
Methodology
Ingredient: Knowledge Base
Case-based reasoning approach, cases described with
class diagrams
Such diagrams are not always available
Human and machine readable pattern format
ESSDP [2]
Ingredient: GQM
Process Summary
◮
Primary Level
◮
Experiment
User Session
◮
Summary
Uses an interactive session with the designer
Uses a knowledge base
Requires too many questions to choose a pattern
Comparison
Conclusion
Recommender System [3]
◮
◮
◮
8 / 21
Uses textual descriptions of patterns
No user feedback
Suitable for small systems
10. Recommendation
System for Design
Patterns in
Software
Development
Outline
Table of Contents
Introduction
Introduction
Motivating Scenario
Design Patterns and
Recommendation Systems
Related Work
Related Work
Methodology
Ingredient: Knowledge Base
Ingredient: GQM
Methodology
Process Summary
Primary Level
Experiment
User Session
Experiment
Summary
Comparison
Conclusion
9 / 21
Conclusion
11. Recommendation
System for Design
Patterns in
Software
Development
Outline
Methodology
Ingredient: Knowledge Base
◮
Introduction
Motivating Scenario
Design Patterns and
Recommendation Systems
Related Work
Methodology
Ingredient: Knowledge Base
Ingredient: GQM
Process Summary
Primary Level
Experiment
User Session
Summary
Comparison
Conclusion
10 / 21
◮
Root of XML is a design pattern category (e.g.,
Creational)
Child nodes are design patterns (e.g., Adapter)
12. Recommendation
System for Design
Patterns in
Software
Development
Methodology
Ingredient: GQM
◮
Outline
◮
Introduction
Motivating Scenario
Design Patterns and
Recommendation Systems
Related Work
◮
Goal: Pattern names
Questions: 2-layered questions, i.e., conditions &
sub-conditions
Metric: Apply a weighting scheme
◮
◮
Answer ∈ {‘yes’, ‘no’ or ‘do not know’}, with a weight
1 ≤ weights ≤ 9
Methodology
Ingredient: Knowledge Base
Ingredient: GQM
Process Summary
Primary Level
Experiment
User Session
Summary
Comparison
Conclusion
n
Pattern Name Tot Weight =∀Applicability
i =1
where, i = j & i ≥ 1, j ≥ 1
11 / 21
n
Weight Pattern Name i Yes Score +
Weight Pattern Name j No Score
j =1
13. Recommendation
System for Design
Patterns in
Software
Development
Methodology
Process Summary
Introduction
Motivating Scenario
Process
Output
Pattern Knowledge
Base
Questionnaire using
GQM model
Recommended design
pattern
User Knowledge
(Experience)
Application of
weighting scheme
Input
Outline
Level 1
(Primary)
Design Patterns and
Recommendation Systems
Related Work
Scoring and ranking
Methodology
Ingredient: Knowledge Base
Ingredient: GQM
Process Summary
Primary Level
Experiment
User Session
Level 2*
(Secondary)
Level 1 Inputs
Refactoring package
design
Refactored system
*
packages
+
Initial designs
Summary
Comparison
Conclusion
12 / 21
Secondary Level Recommendation: Detail methodological
overview and implementation as future works.
14. Recommendation
System for Design
Patterns in
Software
Development
Methodology
Primary Level
Outline
Introduction
Motivating Scenario
Design Patterns and
Recommendation Systems
Related Work
Methodology
Ingredient: Knowledge Base
Ingredient: GQM
Process Summary
Primary Level
Experiment
User Session
Summary
Comparison
Conclusion
◮ DPR is a selection type of expert system
◮ We use a ranking based selection approach
◮ Suggestion segment includes interactive session, calculate weights,
and assign ranks
13 / 21
15. Recommendation
System for Design
Patterns in
Software
Development
Outline
Table of Contents
Introduction
Introduction
Motivating Scenario
Design Patterns and
Recommendation Systems
Related Work
Related Work
Methodology
Ingredient: Knowledge Base
Ingredient: GQM
Methodology
Process Summary
Primary Level
Experiment
User Session
Experiment
Summary
Comparison
Conclusion
14 / 21
Conclusion
16. Recommendation
System for Design
Patterns in
Software
Development
Outline
Introduction
Experiment
Context
◮
Motivating Scenario
Design Patterns and
Recommendation Systems
◮
Related Work
◮
Methodology
Ingredient: Knowledge Base
Ingredient: GQM
◮
Process Summary
A develops a program to display details about its
product in the Console using an Iterator
A outsource Product back-end system to B
B gives back a system that return products as an
Enumeration
Enumeration is a problem for A’s system
Primary Level
Experiment
User Session
Summary
Comparison
Conclusion
Characteristics
◮
8 users as Subjects (6 Grad. Students, 1 Professional
Developer, 1 IT Analyst)
3 design patterns (Adapter, Visitor, Decorator)
◮
◮ 3 other approaches for comparison (ESSDP, ReBuilder, Recommender
System)
15 / 21
17. Recommendation
System for Design
Patterns in
Software
Development
Outline
Introduction
Motivating Scenario
Design Patterns and
Recommendation Systems
Related Work
Methodology
Ingredient: Knowledge Base
Ingredient: GQM
Process Summary
Primary Level
Experiment
User Session
Summary
Comparison
Conclusion
16 / 21
Experiment
User Session
Questions
Response
1. Do you need to use several
yes
existing subclasses?
2. Do you want to create a reusable
yes
class?
3. Do you want to use existing class?
yes
4. Do you want to perform
no
operations on objects?
5. Do you want to avoid polluting
yes
classes with new operations?
6. Do you want to define new
no
operations over the structure?
7. Do you want to add
no
responsibilities to individual objects
dynamically without affecting other?
8. Do you want to use class for
no
responsibilities that can be
withdrawn?
9. Is the extension by subclassing is
no
impractical for your problem?
10. Do you want your clients to be
able to ignore different compositions
of objects and individual objects?
11. Do you want to represent
yes
part-whole hierarchies of objects?
Total weight given by the designer
Weight
8
Adapter
8
Visitor
-
Decorator
-
8
8
-
-
9
4
9
4
9
-
9
4
7
-
7
-
6
6
-
-
7
7
7
-
9
9
9
-
8
8
8
-
0
0
0
0
7
-
-
-
71
59
40
13
18. Recommendation
System for Design
Patterns in
Software
Development
Experiment
Summary
Outline
Introduction
Summary of eight users’ response on DPR:
Motivating Scenario
Design Patterns and
Recommendation Systems
Related Work
Methodology
Ingredient: Knowledge Base
Ingredient: GQM
Process Summary
Primary Level
Experiment
Subject
1
2
3
4
5
6
7
8
User Session
Summary
Comparison
Conclusion
17 / 21
Summary
OO-Level
medium
beginner
advanced
medium
advanced
advanced
medium
advanced
DP-Level
beginner
beginner
medium
beginner
medium
medium
low
beginner
Questions
11
11
10
11
11
11
11
11
Tot.Weight
≥51
≥51
≤50
≥51
≤50
≤50
≤50
≤50
Pattern
Adapter
Visitor
Adapter
both
Adapter
Visitor
Visitor
Visitor
beginner
12.5%
medium
37.5%
advanced
50%
low
12.5%
beginner
50%
medium
37.5%
Questions≤5
0%
Questions≥6
100%
≤50
62.5%
≥51
37.5%
succeed
50
failed
50
19. Recommendation
System for Design
Patterns in
Software
Development
Outline
Experiment
Comparison
- DPR has less number of questions than ESSDP
Approach
Use of Textual Desc.
Use of Ranking
Weighting Scheme
Knowledge Base
User Session
Relevance Score
Certainity≥50%
Pattern Details Shown
Readable Pattern Format
Runtime Reasoning
Introduction
DPR
#
#
ESSDP
#
#
ReBuilder
-
#
#
-
#
Recommerder
System
#
#
#
-
-
#
Motivating Scenario
Design Patterns and
Recommendation Systems
Related Work
Methodology
Ingredient: Knowledge Base
Ingredient: GQM
Process Summary
Primary Level
Experiment
User Session
Summary
Comparison
Conclusion
18 / 21
20. Recommendation
System for Design
Patterns in
Software
Development
Outline
Table of Contents
Introduction
Introduction
Motivating Scenario
Design Patterns and
Recommendation Systems
Related Work
Related Work
Methodology
Ingredient: Knowledge Base
Ingredient: GQM
Methodology
Process Summary
Primary Level
Experiment
User Session
Experiment
Summary
Comparison
Conclusion
19 / 21
Conclusion
21. Recommendation
System for Design
Patterns in
Software
Development
Conclusion
Conclusion
Outline
◮
Introduction
Motivating Scenario
An interactive DPR prototype for suggesting design
patterns
◮
Design Patterns and
Recommendation Systems
◮
Related Work
◮
Methodology
◮
Ingredient: Knowledge Base
Ingredient: GQM
Process Summary
Primary Level
GQM approach
KB for pattern details and relative information
A sample interactive session with the designer
Preliminary evaluation of DPR by 8 subjects shows that
DPR is relatively effective than ESSDP in terms of less
number of questions
Experiment
User Session
Summary
Future Work
Comparison
◮
Conclusion
◮
◮
20 / 21
All 23 design patterns identified by Gamma et al., and
more
A complete interactive tool for both primary and
secondary level
More empirical studies
22. Recommendation
System for Design
Patterns in
Software
Development
Thank You...
Outline
Introduction
Motivating Scenario
Design Patterns and
Recommendation Systems
Related Work
Methodology
Ingredient: Knowledge Base
Ingredient: GQM
Process Summary
Primary Level
Experiment
User Session
Summary
Comparison
Conclusion
21 / 21
◮
Questions...?
23. Recommendation
System for Design
Patterns in
Software
Development
Outline
Introduction
[1] P. Gomes, F. C. Pereira, P. Paiva, N. Seco, P. Carreiro, Jos´ Luis
e
Ferreira and Carlos Bento 2002. Using CBR for Automation of Software
Design Patterns. In Proceedings of the 6th European Conference on
Advances in Case-Based Reasoning, pp:534-548.
[2] R. S. David C. Kung, H. Bhambhani and G. Pancholi. An expert
system for suggesting design patterns - a methodology and a prototype.
In Software Engineering with Computational Intelligence, 2003.
Motivating Scenario
Design Patterns and
Recommendation Systems
Related Work
Methodology
Ingredient: Knowledge Base
Ingredient: GQM
Process Summary
Primary Level
Experiment
User Session
Summary
Comparison
Conclusion
21 / 21
[3] Y. G. Gu´h´neuc, and M. Rabih. A Simple Recommender System for
e e
Design Patterns, Proceedings of the 1st EuroPLoP Focus Group on
Pattern Repositories (2007)