1 / 20

An Empirical Study of the Demeter System

An Empirical Study of the Demeter System. Pengcheng Wu and Mitchell Wand Northeastern University. Motivation. Collect evidence to support the claim: Demeter system improves the – ilities of software systems. In this talk, we focus on a specific – ility : Comprehensibility.

Download Presentation

An Empirical Study of the Demeter System

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. An Empirical Study of the Demeter System Pengcheng Wu and Mitchell Wand Northeastern University

  2. Motivation • Collect evidence to support the claim: Demeter system improves the –ilities of software systems. • In this talk, we focus on a specific –ility: Comprehensibility.

  3. Problem addressed: manual implementation of a traversal on a complex object structure is tedious and error-prone. E.g., AST traversal. Solution: have a high-level description of traversals, then generate the code! System overview

  4. Demeter’s high-level traversal language: strategy Subgraph of transitive closure of class graph Graph language: may be cyclic E.g., from class A via class B to class E A bunch of traversal generating algorithms. E.g., FIRST algorithm [Lieberherr and Wand 2002] System overview (cont.)

  5. from A via B to E class A { void t1() { if(b!=null) b.t1(); } void t1prime() { access(e); if(b!=null) b.t1(); } } class B { void t1() { d.t1(); } } class D { void t1() { a.t1prime(); } } FIRST Algorithm

  6. from A via B to E High-level description is much easier to understand! class A { void t1() { if(b!=null) b.t1(); } void t1prime() { access(e); if(b!=null) b.t1(); } } class B { void t1() { d.t1(); } } class D { void t1() { a.t1prime(); } }

  7. Q: Do you have any more convincing statistics? • A: YES! The largest software system using Demeter’s traversal strategies: the DemeterJ Compiler. It has 413 classes, 80 traversals on ASTs

  8. How complex are those traversals?

  9. How complex are those traversals? (cont.)

  10. Traversal strategies improve comprehensibility • How to measure the improvement? Abstractness of a traversal strategy =Length(MethodCallPaths)/Length(Strategy) The larger the ratio is, the more abstract the strategy is, then the more details are left out and the better comprehensibility we achieve.

  11. The abstractness metric

  12. Conclusion • Traversals on complex object structures tend to be complex too. • High level description of traversals helps improve the comprehensibility of the traversal concerns in software system. • The improvements are nontrivial.

  13. Specific, explicit, closed Controls spuriousness Leads to Brittleness Predictability Rigidity Generic, implicit, open-ended Controls brittleness Leads to Spuriousness comprehensability Evolvability Tradeoff in AOP

  14. Specific, explicit, closed Controls spuriousness Leads to Brittleness Predictability Rigidity Complex request to base Hospital, go left,right,up Base can refuse Generic, implicit, open-ended Controls brittleness Leads to Spuriousness comprehensability Evolvability Complex request to base Place where they heal people Tradeoff in AOP

  15. Questions and Discussions ...

  16. Edinburgh, Scottish symbols • Mik: • Effects of control flow advice • Query languages • 3 layer structure, editing at second layer

  17. NSF design proposal • CME and Demeter • Use selector language to define editing • Selector language needs unification, pattern matching • Enhancement: SelectorExpression(p1, … ) {body}

  18. Mario • Visitor makes assumptions on class graph • Analyze traversal graph: another graph intersection

  19. Pengcheng • Traversal graph: pcd and call graph • call f()) from main() to call f() • cflow(call f()) = from main() via call f() to * • Cflow(p) = from main() via pathset to * • Pathset starts at Main • Join(Pathset(p), target(…) to *

  20. !call f() = !pathset(from main to f()) • Same source, same target: all other paths • !(from A to B) : from A to !B: forward from A, backward from all other nodes • !(from A via B to C) = from A via !B to C or from A via B to !C or from A via !B to !C • !([A,B].[B,C]) =[A,!B].[!B,C] or [A,B][B,!C] • !(D1.D2) =!D1.D2’ || D1.!D2

More Related