Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "An Empirical Study of the Demeter System Pengcheng Wu and Mitchell Wand Northeastern University."— 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 System overview 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!

4 System overview (cont.) 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]

5 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(); } from A via B to E FIRST Algorith m

6 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(); } from A via B to E High-level description is much easier to understand!

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 Tradeoff in AOP Specific, explicit, closed Controls spuriousness Leads to Brittleness Predictability Rigidity Generic, implicit, open-ended Controls brittleness Leads to Spuriousness comprehensability Evolvability

14 Tradeoff in AOP 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

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


Download ppt "An Empirical Study of the Demeter System Pengcheng Wu and Mitchell Wand Northeastern University."

Similar presentations


Ads by Google