Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 A Graph-Based Metamodel for Object-Oriented Software Metrics Tom Mens( ) Postdoctoral Fellow – Fund for Scientific.

Similar presentations


Presentation on theme: "1 A Graph-Based Metamodel for Object-Oriented Software Metrics Tom Mens( ) Postdoctoral Fellow – Fund for Scientific."— Presentation transcript:

1 1 A Graph-Based Metamodel for Object-Oriented Software Metrics Tom Mens( ) Postdoctoral Fellow – Fund for Scientific Research (Flanders) Vrije Universiteit Brussel, Belgium

2 ICGT, 10 October 2002, Barcelona © Tom Mens, Vrije Universiteit Brussel 2 Goal  use graphs as an underlying formalism/representation to  define a formal framework for OO metrics independent of  the programming language (e.g., Smalltalk, Java, or C++)  the life-cycle phase (e.g., design or implementation)  identify a minimal set of primitive functions to cover an as wide variety of OO metrics as possible  implement open and customisable metrics tools  easy to add new OO metrics  easy to incorporate new language features  easy to use and customise at different levels of abstraction

3 ICGT, 10 October 2002, Barcelona © Tom Mens, Vrije Universiteit Brussel 3 Approach  top-down  improve existing metrics tools  CodeCrawler  SoulMetrics  bottom-up  develop generic graph-based formalism  validate  on a variety of OO metrics suites  on a significant number of different programs

4 ICGT, 10 October 2002, Barcelona © Tom Mens, Vrije Universiteit Brussel 4 Tool support: CodeCrawler  a language independent reverse engineering tool  combines metrics and software visualization  based on the FAMIX language-independent metamodel  implemented in VisualWorks 3.0 Smalltalk  runs on every major platform

5 ICGT, 10 October 2002, Barcelona © Tom Mens, Vrije Universiteit Brussel 5 Tool support: CodeCrawler

6 ICGT, 10 October 2002, Barcelona © Tom Mens, Vrije Universiteit Brussel 6 Tool support: CodeCrawler

7 ICGT, 10 October 2002, Barcelona © Tom Mens, Vrije Universiteit Brussel 7 Tool support: SoulMetrics  a generic logic-programming-based metrics tool  defined in SOUL, a logic meta-programming environment  on top of Smalltalk VisualWorks 7  a collection of logic predicates  fully integrated in the Smalltalk GUI (browser)  runs on every major platform

8 ICGT, 10 October 2002, Barcelona © Tom Mens, Vrije Universiteit Brussel 8 Tool support: SoulMetrics

9 ICGT, 10 October 2002, Barcelona © Tom Mens, Vrije Universiteit Brussel 9 Tool support: SoulMetrics

10 ICGT, 10 October 2002, Barcelona © Tom Mens, Vrije Universiteit Brussel 10 Tool support: SoulMetrics

11 ICGT, 10 October 2002, Barcelona © Tom Mens, Vrije Universiteit Brussel 11 Represent software as graphs  Directed attributed multi-graphs

12 ICGT, 10 October 2002, Barcelona © Tom Mens, Vrije Universiteit Brussel 12 Primitive graph functions  pred: Node  P F (Node)predecessor nodes  succ: Node  P F (Node)successor nodes  fanIn: Node  P F (Edge)incoming edges  fanOut: Node  P F (Edge)outgoing edges  path: Node  Node  P F (Edge)edge paths + iterative versions pred i, pred +, pred*, succ i, succ +, succ*

13 ICGT, 10 October 2002, Barcelona © Tom Mens, Vrije Universiteit Brussel 13 Primitive graph functions  pred(c 4 )

14 ICGT, 10 October 2002, Barcelona © Tom Mens, Vrije Universiteit Brussel 14 Primitive graph functions  succ(c 4 )

15 ICGT, 10 October 2002, Barcelona © Tom Mens, Vrije Universiteit Brussel 15 Primitive graph functions  fanIn(c 3 )

16 ICGT, 10 October 2002, Barcelona © Tom Mens, Vrije Universiteit Brussel 16 Primitive graph functions  fanOut(c 3 )

17 ICGT, 10 October 2002, Barcelona © Tom Mens, Vrije Universiteit Brussel 17 Primitive graph functions  path(c 2,c)

18 ICGT, 10 October 2002, Barcelona © Tom Mens, Vrije Universiteit Brussel 18 Qualified graph functions  pred: Node  NodeConstraint  EdgeConstraint  P F (Node)  idem for pred i, pred +, pred*, succ i, succ +, succ*  fanIn: Node  EdgeConstraint  P F (Edge)  idem for fanOut  path: Node  Node  NodeConstraint  EdgeConstraint  P F (Edge + )  begin is defined in terms of pred*  calculates all nodes that have no predecessors  end is defined in terms of succ*  calculates all nodes that have no successors

19 ICGT, 10 October 2002, Barcelona © Tom Mens, Vrije Universiteit Brussel 19 Qualified graph functions  fanIn(c,isNoUsesEdge)

20 ICGT, 10 October 2002, Barcelona © Tom Mens, Vrije Universiteit Brussel 20 Qualified graph functions  pred(c,isClassNode,isUsesEdge)

21 ICGT, 10 October 2002, Barcelona © Tom Mens, Vrije Universiteit Brussel 21 Object-oriented inheritance metrics  Let n  Node such that isClassNode(n) subclasses(n) := pred(n,isClassNode,isInheritsEdge) descendants(n) := pred + (n,isClassNode,isInheritsEdge) leafClasses(n) := start(n,isClassNode,isInheritsEdge) inheritanceToRoot(n) :=  path(n,m,isClassNode,isInheritsEdge) m  end(n,isClassNode,isInheritsEdge) NOS(n) = |subclasses(n)| NOD(n) = |descendants(n)| NOL(n) = |leafClasses(n)| DIT(n) = average(inheritanceToRoot(n),map(length))

22 ICGT, 10 October 2002, Barcelona © Tom Mens, Vrije Universiteit Brussel 22 Object-oriented inheritance metrics  subclasses(c)NOS(c)=2

23 ICGT, 10 October 2002, Barcelona © Tom Mens, Vrije Universiteit Brussel 23 Object-oriented inheritance metrics  descendants(c)NOD(c)=4

24 ICGT, 10 October 2002, Barcelona © Tom Mens, Vrije Universiteit Brussel 24 Object-oriented inheritance metrics  leafClasses(c)NOL(c)=2

25 ICGT, 10 October 2002, Barcelona © Tom Mens, Vrije Universiteit Brussel 25 Object-oriented inheritance metrics  inheritanceToRoot(c 2 )DIT(c 2 )=2

26 ICGT, 10 October 2002, Barcelona © Tom Mens, Vrije Universiteit Brussel 26 Ratio Metrics  MethodHidingFactor(n) = 1 – Ratio(succ,isMethodNode,isPublicNode,isContainsEdge)(n) = 1- |succ(n,isMethodNode  isPublicNode,isContainsEdge)| |succ(n,isMethodNode,isContainsEdge)|  AbstractSubclassRatio(n) = 1 – Ratio(pred,isClassNode,isAbstractNode,isInheritsEdge)(n)  LeafclassRatio(n) = 1 – Ratio(pred*,isClassNode,isInheritanceLeaf,isInheritsEdge)(n)


Download ppt "1 A Graph-Based Metamodel for Object-Oriented Software Metrics Tom Mens( ) Postdoctoral Fellow – Fund for Scientific."

Similar presentations


Ads by Google