Your SlideShare is downloading. ×

ICPC08a.ppt

84

Published on

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
84
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Mendel: A Model, Metrics, and Rules to Understand Class Hierarchies Simon Denier & Yann-Gaël Guéhéneuc Ptidej Team – Université de MontréalICPC 2008 12/06/2008
  • 2. Outline Motivation and Problem Mendel Model Interesting Classes Subclassing Behaviors Conclusion 2 / 28
  • 3. Motivation Context: maintenance of program without documentation  Task: identify and understand the role of multiple classes Problem 1: where to start?  Find entry points (main(...))  Read large classes (by LOC or Number of Methods) Problem 2: what about inheritance? 3 / 28
  • 4. Problem: Class Hierarchies Classes defined incrementally by inheritance  Class “interesting” in its own hierarchy  Class profiting from its hierarchy 4 / 28
  • 5. Class HierarchiesJHotDraw5.2 5 / 28
  • 6. Class Hierarchies (2)Azureus2.4.0.2 6 / 28
  • 7. Outline Motivation and Problem Mendel Model Interesting Classes Subclassing Behaviors Conclusion 7 / 28
  • 8. Mendel Approach Goal: insights on class hierarchies  Interesting classes in their own hierarchy  Subclassing behaviors: extending (adding) vs overriding Characteristics (requirements) of our approach  Early stage in maintenance  Intuitive  Fast 8 / 28
  • 9. Mendel: Generic Model A B foo() bar() Inherited foo() Super Overridden bar() Total B New zorg() Local bar() zorg()Simple UML Mendel 9 / 28
  • 10. Mendel: Metrics and Rules Simple metrics:  Based on interfaces = sets of method signatures  Computed on a single class or a hierarchy Rules for:  Selection (threshold)  Classification  Comprehension (rule of thumb) 10 / 28
  • 11. Outline Motivation and Problem Mendel Model Interesting Classes Subclassing Behaviors Conclusion 11 / 28
  • 12. Interesting Classes Classes defining a lot of new behaviors Large class: overall system Budding class: with respect to its hierarchy Blooming class: large and budding 12 / 28
  • 13. Large Class Class with a large interface Large Class: |Local| > threshold( |Local| ) JHotDraw 1. StandardDrawingView (inherits from JPanel), 55 methods 2. DrawApplication (inherits from JFrame), 53 methods 3. AbstractFigure (inherits from Object), 34 methods 13 / 28
  • 14. Budding Class Class with a large interface with respect to its hierarchy Metrics:  Branch Mean Size – bms = |Total| / (DIT + 1)  Novelty Index – nvi = |Local| / bms(superclass) Budding class: nvi > threshold(nvi) JHotDraw 1. AbstractFigure, 3.09 2. TextFigure, 1.84 3. PolygonFigure, 1.59 14 / 28
  • 15. Blooming Class Synthesis: combining large and budding Novelty Score – nvs = |Local| × nvi Blooming Class: nvs > threshold(nvs) JHotDraw 1. AbstractFigure, 105.09 2. TextFigure, 55.1 3. LineConnection, 49.55 15 / 28
  • 16. JHotDraw Overview with Mendel JHotDraw 5.2: 148 classes  13 large (9%)  18 budding (12%)  11 blooming (7%) Among 11 blooming classes  8 in AbstractFigure hierarchy  + DrawApplication, StandardDrawingView, ConnectionTool 16 / 28
  • 17. JHotDraw Base Classes Given documentation: 6 base classes 17 / 28
  • 18. Comparison with Documentation 5 out of 6 in at least one set  AbstractFigure in all 3 sets Large Budding Blooming 18 / 28
  • 19. What about StandardDrawing? Max rank: 16th by |Local| order Reason: overrider of CompositeFigure (4th blooming class) Conclusion: StandardDrawing to be understood in relation with CompositeFigure 19 / 28
  • 20. Outline Motivation and Problem Mendel Model Interesting Classes Subclassing Behaviors Conclusion 20 / 28
  • 21. Subclassing BehaviorsPure Overrider Overrider Extender Pure Extender INH INH INH INH OVR OVR OVR NEW NEW NEW |NEW|=0 |OVR|≥|NEW| |NEW|>|OVR| |OVR|=0 21 / 28
  • 22. Extender vs Overrider Rules of thumb Pure extender  Adding new methods: no access through superclass  Used for itself  Implementation inheritance Pure overrider  Overriding methods  Used through substitution to superclass  Interface inheritance 22 / 28
  • 23. JHotDraw in Verso 23 / 28
  • 24. Azureus in Verso 24 / 28
  • 25. Implementation in Java Tailored for Java  BCEL as class files parser Performance for Azureus (1681 classes)  Standard desktop machine (2Ghz processor, 1Go memory)  9 seconds 25 / 28
  • 26. Outline Motivation and Problem Mendel Model Interesting Classes Subclassing Behaviors Conclusion 26 / 28
  • 27. Conclusion Mendel  Generic model  Simple metrics  Rules Results  Quick insights on interesting classes and concerns  Large, budding, blooming: different views of interesting classes  Concerns: keywords in classnames  Different usage of inheritance in programs  Some leaned to extending (Log4J, Azureus)  Others to overriding (JHotDraw, ArgoUML) 27 / 28
  • 28. Future Work Family analysis  Family = class + children  Common behavior and interface Visualisation  Hierarchy representation  Visual patterns 28 / 28
  • 29. ArgoUML in Verso 29 / 28
  • 30. Blooming Classes Selectivity Log4J: 2 of 206 (1%)  LogBrokerMonitor (104 methods), Category  Budding set: Appender hierarchy ArgoUML: 18 of 1431 (1%)  2 very big classes: NSUMLModelFacade, FacadeMDRImpl  Design choice: Facade design pattern  Keywords in class names: two products, normal and MDR Azureus: 54 of 1681 (3%)  Keywords in class names: three concerns, download, peer, DHT 30 / 28
  • 31. Behaviors Discrimination Two categories  JHotDraw and ArgoUML: overriding behaviors  Large proportions of Pure Overriders  Azureus and Log4J: extending behaviors  Azureus: 58% of classes are Pure Extenders 31 / 28

×