Ppap13a.ppt
Upcoming SlideShare
Loading in...5
×
 

Ppap13a.ppt

on

  • 231 views

Anti-patterns, design patterns, binary class relationships

Anti-patterns, design patterns, binary class relationships

Statistics

Views

Total Views
231
Views on SlideShare
215
Embed Views
16

Actions

Likes
0
Downloads
0
Comments
0

2 Embeds 16

http://www.ptidej.net 15
http://ptidej.net 1

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Ppap13a.ppt Ppap13a.ppt Presentation Transcript

  • Jaafar, YannGuéhéneuc, Fehmi Jaafar, Yann-Gaël Guéhéneuc, and Sylvie Hamel DIRO, Université de Montréal, QC, Canada 1
  • 1. Introduction 2. Related Work 3. Problem Statement 4. Empirical Study 5. Research Question 6. Results 7. Ongoing Work 8. Conclusion 2
  • Anti-patterns are motifs that are commonly used by developers but they are ineffective and counterproductive in program development and–or maintenance. Opposite to anti-patterns, design patterns are “good” solutions to recurring design problems, conceived to increase reuse, code quality, code readability and, above all, maintainability and resilience to changes. These motifs evolve and they may have dependencies. 3
  • Vokac[1] analyzed the corrective maintenance of a large commercial program, compared the defect rates of classes participating in design motifs against those that did not. Observer and Singleton motifs are correlated with larger classes Classes playing roles in Factory Method were more compact, less coupled, and less defect prone than others classes. No clear tendency exists for Template Method. Pietrzak and Walter[2] defined and analyzed the different relationships that exist among smells. These relationships presented dependencies between smells and could be exploited to improve the detection tools of anti-patterns. [1] M. Vokac, “Defect frequency and design patterns: An empirical study of industrial code,” IEEE Trans. Softw. Eng., vol. 30, December 2004. [2] B. Pietrzak and B. Walter, “Leveraging code smell detection with intersmell relations,” Extreme Programming and Agile Processes in Software Engineering, pp. 75–84, 2006. 4
  • Most previous work agree that anti-patterns make the maintenance of systems more difficult and that design patterns can serve as guide in program exploration and, thus, ease maintenance. However, there are no investigation in the literature about the static relationships among anti-patterns and design patterns. Better understand systems by giving knowledge about the dependencies between what is “good” and what is “bad” in system. Explain the co-existence of such motifs 5
  • org.apache.xerces.validators.common.XMLValidator.java r315086 | twl | 1999-11-08 20:10:52 -0500 (Mon, 08 Nov 1999) Initial revision org.apache.xerces.validators.dtd.DTDImporter.java r315397 | jeffreyr | 2000-04-04 15:38:39 -0400 (Tue, 04 Apr 2000) Factoring Validators code by Glenn Marcy 6
  • We use the Defect DEtection for CORrection Approach (DECOR to specify and detect anti-patterns. [3]) We use the Design Motif Identification Multilayered Approach (DeMIMA [4]) to detect design patterns and static relationships [4] Naouel Moha, Y.-G. Guéhéneuc, L. Duchien, and A.-F. Le Meur, “DECOR: A method for the specification and detection of code and design smells,” Transactions on Software Engineering (TSE), vol. 36, no. 1, 2010. Y.-G. Guéhéneuc and G. Antoniol, “DeMIMA: A multilayered framework for design pattern identification,” Transactions on Software Engineering (TSE), vol. 34, no. 5, pp. 667–684, 2008. 7
  • System AntiAnti-pattern Design pattern Static relationship ArgoUML ComplexClass Command Use JFreeChart LongMethod Composite Association XercesJ LongParameterList Decorator Agregation MessageChains FactoryMethod Composition RefusedParentBequest Prototype SpaghettiCode Observer SpeculativeGenerality SwissArmyKnife 8
  • Are there static relationships between antiantipatterns and design patterns? We assume that a design pattern P has a static relationships with the anti-pattern A if at least one class belonging to P has a use, association, aggregation, or composition relationship with one class belonging to A. 9
  • 10
  • 11
  • 12
  • Different anti-patterns can have different proportions of static relationships with design patterns. The design pattern that often has the most relationships with anti patterns is the Command design pattern. For example, we noted that 50% of static relationships among SpeculativeGenerality and design patterns in ArgoUML, are with the Command motifs. In XercesJ, we observe that 41% of relationships among ClassDataShouldBePrivate was with the Command design pattern. 13
  • SpaghettiCodes have no static relationships (use, association, aggregation, and composition) with design patterns. SpaghettiCode are revealed by classes with no structure, declaring long methods with no parameters, and using global variables for processing. A SpaghettiCode does not take the advantage of object-orientation mechanisms: polymorphism and inheritance. SpaghettiCodes are difficult to reuse and to maintain. 14
  • The evolution of relationships among motifs. Prevent the co-exsitence of anti-patterns and design patterns. Studying the effect of the anti-patterns dependencies on change-proneness. The relation between classes having static dependencies with anti-patterns and fault-proneness. The relation between classes co-changed with anti-patterns and faultproneness. 15
  • We provide empirical evidence of the relationships between anti-patterns and design patterns. Some anti-patterns are significantly more likely to have relationships with design patterns than other. We provide a basis for future research to understand the causes and the eventual consequences of these relationships. 16