A Graphical Notation for Design Pattern Detection Haneen Dabain - - PowerPoint PPT Presentation

a graphical notation for design pattern detection
SMART_READER_LITE
LIVE PREVIEW

A Graphical Notation for Design Pattern Detection Haneen Dabain - - PowerPoint PPT Presentation

A Graphical Notation for Design Pattern Detection Haneen Dabain Department of Computer Science and Engineering York University October 24, 2011 Haneen Dabain (York University) FINDER October 24, 2011 1 / 56 Introduction Table of contents


slide-1
SLIDE 1

A Graphical Notation for Design Pattern Detection

Haneen Dabain

Department of Computer Science and Engineering York University

October 24, 2011

Haneen Dabain (York University) FINDER October 24, 2011 1 / 56

slide-2
SLIDE 2

Introduction

Table of contents

1

Introduction Design Pattern Detection Detection Results Evaluation

2

Our Contribution

3

The FINDER Notation

4

The FINDER Tool

5

Experiments

6

Conclusion

7

Future Work

Haneen Dabain (York University) FINDER October 24, 2011 2 / 56

slide-3
SLIDE 3

Introduction Design Pattern Detection

Design Pattern Detection

Design patterns are well-known and frequently reused structures in the software development community. Design patterns enable large scale system reuse of software architectures. Design patterns help maintainers understand the system and the decisions made when designing and implementing the system. Design patterns help developer become proficient in the source code. Design patterns are often scattered in the source code of systems after implementation.

Haneen Dabain (York University) FINDER October 24, 2011 3 / 56

slide-4
SLIDE 4

Introduction Design Pattern Detection

Design Pattern Detection

Documentation of a system’s design is often obsolete, if it exists at all. Design choices are thus lost. Analyzing systems manually to extract the design patterns can be time consuming and infeasible. Design pattern detection tools have been developed to automatically extract design pattern implementations.

Haneen Dabain (York University) FINDER October 24, 2011 4 / 56

slide-5
SLIDE 5

Introduction Design Pattern Detection

Coarse-Grained Analysis vs. Fine-Grained Analysis

Coarse-Grained Analysis Considers high-level information about system structure such as class inheritance and hierarchies, and class dependencies and interaction. Relatively fast. Scales well on large systems. The high-level information may not be sufficient to clearly differentiate between some design patterns.

Haneen Dabain (York University) FINDER October 24, 2011 5 / 56

slide-6
SLIDE 6

Introduction Design Pattern Detection

Coarse-Grained Analysis vs. Fine-Grained Analysis

Fine-Grained Analysis Captures finer details about the system’s structure such as method signatures, method invocations, and field declarations. Provides more accurate results. May become infeasible when applied on large scale systems due to lack of memory or intensive CPU usage.

Haneen Dabain (York University) FINDER October 24, 2011 6 / 56

slide-7
SLIDE 7

Introduction Design Pattern Detection

Design Pattern Detection

Different tools produce different results and therefore vary in their performance. Results need to be evaluated to measure tools performance.

Haneen Dabain (York University) FINDER October 24, 2011 7 / 56

slide-8
SLIDE 8

Introduction Detection Results Evaluation

Detection Results Evaluation

Precision and recall rates.

Precision rate: The percentage of true implementations in the recovered implementations (Accuracy). Recall rate: The percentage of the actual true implementations that are correctly recovered (Completeness).

Various studies have been conducted in order to evaluate and compare the results obtained by different tools.

Haneen Dabain (York University) FINDER October 24, 2011 8 / 56

slide-9
SLIDE 9

Introduction Detection Results Evaluation

Detection Results Evaluation

Challenges: Design pattern implementation variations. Different tools use different design pattern definitions. Evaluating results against different systems. No gold standard against which the tools are being evaluated.

Haneen Dabain (York University) FINDER October 24, 2011 9 / 56

slide-10
SLIDE 10

Introduction Detection Results Evaluation

Detection Results Evaluation

Challenges: Design pattern implementation variations. Different tools use different design pattern definitions. Evaluating results against different systems. No gold standard against which the tools are being evaluated.

Haneen Dabain (York University) FINDER October 24, 2011 10 / 56

slide-11
SLIDE 11

Introduction Detection Results Evaluation

Detection Results Evaluation

Example: Proxy design pattern

Haneen Dabain (York University) FINDER October 24, 2011 11 / 56

slide-12
SLIDE 12

Introduction Detection Results Evaluation

Detection Results Evaluation

Example: Proxy design pattern PINOT: Recovered Not recovered!

Haneen Dabain (York University) FINDER October 24, 2011 11 / 56

slide-13
SLIDE 13

Introduction Detection Results Evaluation

Detection Results Evaluation

Example: Template Method design pattern

Haneen Dabain (York University) FINDER October 24, 2011 12 / 56

slide-14
SLIDE 14

Introduction Detection Results Evaluation

Detection Results Evaluation

Example: Template Method design pattern

Haneen Dabain (York University) FINDER October 24, 2011 13 / 56

slide-15
SLIDE 15

Introduction Detection Results Evaluation

Detection Results Evaluation

Example: Template Method design pattern

  • SSA: Recovered
  • PINOT: Not recovered!

Haneen Dabain (York University) FINDER October 24, 2011 13 / 56

slide-16
SLIDE 16

Our Contribution

Table of contents

1

Introduction Design Pattern Detection Detection Results Evaluation

2

Our Contribution

3

The FINDER Notation

4

The FINDER Tool

5

Experiments

6

Conclusion

7

Future Work

Haneen Dabain (York University) FINDER October 24, 2011 14 / 56

slide-17
SLIDE 17

Our Contribution

Our Contribution

The introduction of a graphical notation for describing design pattern definitions.

Describes the properties of design pattern implementations. Supports design pattern variations.

The introduction of design pattern definitions catalogue, such that these definitions:

Translate to a set of fine-grained rules that can be used for detecting design patterns. Provide developers with roadmap for implementing design patterns.

Haneen Dabain (York University) FINDER October 24, 2011 15 / 56

slide-18
SLIDE 18

Our Contribution

Our Contribution

The development of a tool that recovers design pattern implementations using fine-grained rules that correspond to design pattern definitions. The evaluation of the effectiveness of our approach in terms of results correctness and scalability.

Haneen Dabain (York University) FINDER October 24, 2011 16 / 56

slide-19
SLIDE 19

The FINDER Notation

Table of contents

1

Introduction Design Pattern Detection Detection Results Evaluation

2

Our Contribution

3

The FINDER Notation

4

The FINDER Tool

5

Experiments

6

Conclusion

7

Future Work

Haneen Dabain (York University) FINDER October 24, 2011 17 / 56

slide-20
SLIDE 20

The FINDER Notation

The FINDER Notation

FINDER (FINe-grained DEtection Rules) UML-like diagrams describing fine-grained rules used for the detection of design pattern implementations.

Haneen Dabain (York University) FINDER October 24, 2011 18 / 56

slide-21
SLIDE 21

The FINDER Notation

Example: The State Design Pattern FINDER Definition

Haneen Dabain (York University) FINDER October 24, 2011 19 / 56

slide-22
SLIDE 22

The FINDER Notation

Example: The State Design Pattern FINDER Definition

Haneen Dabain (York University) FINDER October 24, 2011 20 / 56

slide-23
SLIDE 23

The FINDER Notation

Example: The State Design Pattern FINDER Definition

Haneen Dabain (York University) FINDER October 24, 2011 21 / 56

slide-24
SLIDE 24

The FINDER Notation

Example: The State Design Pattern FINDER Definition

Haneen Dabain (York University) FINDER October 24, 2011 22 / 56

slide-25
SLIDE 25

The FINDER Notation

Example: The State Design Pattern FINDER Definition

Haneen Dabain (York University) FINDER October 24, 2011 23 / 56

slide-26
SLIDE 26

The FINDER Notation

Example: The State Design Pattern FINDER Definition

Haneen Dabain (York University) FINDER October 24, 2011 24 / 56

slide-27
SLIDE 27

The FINDER Notation

Example: The State Design Pattern FINDER Definition

Haneen Dabain (York University) FINDER October 24, 2011 25 / 56

slide-28
SLIDE 28

The FINDER Notation

Example: The State Design Pattern FINDER Definition

Haneen Dabain (York University) FINDER October 24, 2011 26 / 56

slide-29
SLIDE 29

The FINDER Notation

How does the FINDER notation help? FINDER definitions provide developers with guidelines for implementing design patterns. Different tools can use the FINDER notation as a common language for representing their detections rules. The visual aspect will help understand fine-grained rules and their contribution to the design pattern implementations. Facilitates comparison between different design pattern definitions used by different tools

Haneen Dabain (York University) FINDER October 24, 2011 27 / 56

slide-30
SLIDE 30

The FINDER Tool

Table of contents

1

Introduction Design Pattern Detection Detection Results Evaluation

2

Our Contribution

3

The FINDER Notation

4

The FINDER Tool

5

Experiments

6

Conclusion

7

Future Work

Haneen Dabain (York University) FINDER October 24, 2011 28 / 56

slide-31
SLIDE 31

The FINDER Tool

The FINDER Tool

Approach Static Fact Extraction: Create a factbase of fine-grained information about the system structure and components. Design Pattern Instance Recovery: Filter the factbase for components that match design pattern definition rules.

Haneen Dabain (York University) FINDER October 24, 2011 29 / 56

slide-32
SLIDE 32

The FINDER Tool

The FINDER Tool

Static Fact Extraction Javex and QL are used to produce a factbase that contains information about class hierarchies and attributes, class methods and fields, class interaction, and methods signature. Limitation: Javex is unable to capture the type of objects contained in collections.

Haneen Dabain (York University) FINDER October 24, 2011 30 / 56

slide-33
SLIDE 33

The FINDER Tool

VariableExplorer

The VariableExplorer Tool Collects information about collections, methods invoked on collections, and the parameters sent to those methods. This information is used to estimate the type of objects in collections.

Haneen Dabain (York University) FINDER October 24, 2011 31 / 56

slide-34
SLIDE 34

The FINDER Tool

VariableExplorer

AST (Abstract Syntax Tree) AST is a tree representation of the abstract syntactic structure of source code. Each element in the Java source file is represented as an ASTNode. ASTVisitor traverses ASTNodes and gathers information about their properties and fragments.

Haneen Dabain (York University) FINDER October 24, 2011 32 / 56

slide-35
SLIDE 35

The FINDER Tool

VariableExplorer

How it works

Haneen Dabain (York University) FINDER October 24, 2011 33 / 56

slide-36
SLIDE 36

The FINDER Tool

VariableExplorer

How it works

Haneen Dabain (York University) FINDER October 24, 2011 34 / 56

slide-37
SLIDE 37

The FINDER Tool

VariableExplorer

How it works

Haneen Dabain (York University) FINDER October 24, 2011 35 / 56

slide-38
SLIDE 38

The FINDER Tool

VariableExplorer

How it works

Haneen Dabain (York University) FINDER October 24, 2011 36 / 56

slide-39
SLIDE 39

The FINDER Tool

VariableExplorer

How it works

Haneen Dabain (York University) FINDER October 24, 2011 37 / 56

slide-40
SLIDE 40

The FINDER Tool

VariableExplorer

How it works

Haneen Dabain (York University) FINDER October 24, 2011 38 / 56

slide-41
SLIDE 41

Experiments

Table of contents

1

Introduction Design Pattern Detection Detection Results Evaluation

2

Our Contribution

3

The FINDER Notation

4

The FINDER Tool

5

Experiments

6

Conclusion

7

Future Work

Haneen Dabain (York University) FINDER October 24, 2011 39 / 56

slide-42
SLIDE 42

Experiments

AJP Implementations

Recall rate: 100%, Precision rate of 78%

Haneen Dabain (York University) FINDER October 24, 2011 40 / 56

slide-43
SLIDE 43

Experiments

Additional Implementation Variations

Haneen Dabain (York University) FINDER October 24, 2011 41 / 56

slide-44
SLIDE 44

Experiments

Additional Implementation Variations - Continued

Recall rate: 100%, Precision rate of 88%

Haneen Dabain (York University) FINDER October 24, 2011 42 / 56

slide-45
SLIDE 45

Experiments

AJP Implementations

Design Pattern Options

Haneen Dabain (York University) FINDER October 24, 2011 43 / 56

slide-46
SLIDE 46

Experiments

AJP Implementations

Composite Implementation

Haneen Dabain (York University) FINDER October 24, 2011 44 / 56

slide-47
SLIDE 47

Experiments

AJP Implementations

Recovered Composite Implementation

Haneen Dabain (York University) FINDER October 24, 2011 45 / 56

slide-48
SLIDE 48

Experiments

AJP Implementations

Recovered Composite Implementation

Haneen Dabain (York University) FINDER October 24, 2011 46 / 56

slide-49
SLIDE 49

Experiments

AJP Implementations

Recovered Composite Implementation without VariableExplorer

Haneen Dabain (York University) FINDER October 24, 2011 47 / 56

slide-50
SLIDE 50

Experiments

AJP Implementations

Recovered Composite Implementation without VariableExplorer

Haneen Dabain (York University) FINDER October 24, 2011 48 / 56

slide-51
SLIDE 51

Experiments

Experiments Results

AJP Implementations

Haneen Dabain (York University) FINDER October 24, 2011 49 / 56

slide-52
SLIDE 52

Experiments

Experiments Results

GTDFree and JHotDraw FINDER was able to correctly recover several design pattern implementations, and that it scales well on large scale real life systems.

Haneen Dabain (York University) FINDER October 24, 2011 50 / 56

slide-53
SLIDE 53

Conclusion

Table of contents

1

Introduction Design Pattern Detection Detection Results Evaluation

2

Our Contribution

3

The FINDER Notation

4

The FINDER Tool

5

Experiments

6

Conclusion

7

Future Work

Haneen Dabain (York University) FINDER October 24, 2011 51 / 56

slide-54
SLIDE 54

Conclusion

Conclusion

FINDER notation describes fine-grained rules for design pattern detection, and helps understand fine-grained rules. FINDER definitions of the design patterns used as guidelines for building design patterns in Java. FINDER gave more accurate results than the tools it was compared against. FINDER scales well on large real life systems.

Haneen Dabain (York University) FINDER October 24, 2011 52 / 56

slide-55
SLIDE 55

Future Work

Table of contents

1

Introduction Design Pattern Detection Detection Results Evaluation

2

Our Contribution

3

The FINDER Notation

4

The FINDER Tool

5

Experiments

6

Conclusion

7

Future Work

Haneen Dabain (York University) FINDER October 24, 2011 53 / 56

slide-56
SLIDE 56

Future Work

Future Work

Conducting further analyses of design patterns implementation in Java systems to produce more refined and flexible fine-grained definitions. Creating FINDER definitions for new design patterns and adding them to our catalogue. Improving the performance of the FINDER tool, by optimizing the scripts used for factbase production and design patterns recovery. Performing further tests to better evaluate the performance of our tool.

Haneen Dabain (York University) FINDER October 24, 2011 54 / 56

slide-57
SLIDE 57

Questions

Haneen Dabain (York University) FINDER October 24, 2011 55 / 56

slide-58
SLIDE 58

Questions

Thank you!

Haneen Dabain (York University) FINDER October 24, 2011 56 / 56