class graph neo4j and software metrics

Download Class graph neo4j and software metrics

If you can't read please download the document

Post on 22-May-2015

1.130 views

Category:

Technology

3 download

Embed Size (px)

DESCRIPTION

Each of the files or classes of a projects source code represents a tree (AST). Looking at dependencies to other classes besides inheritance creates a graph though. Field types and method parameters are also implicit dependencies. Storing this information in a graph database like Neo4j allows for interesting queries and insights. Class-Graph provides that and is available as open-source github project.

TRANSCRIPT

  • 1. Neo4j in ActionSoftware MetricsMichael Hunger (@mesirii)11

2. Graphs in Software Technolgoy UML Diagrams are graphs dependencies between classes, packages, modules etc are graphs Software Metrics use dependency analysis Visualizations Cyclomatic Complexity, Fan-in (afferent-coupling) / Fan-out (efferent coupling) etc. 2 2 3. Code City33 4. Class Diagram is a Graph 4 4 5. SonarJ 5 5 6. But there is moreVisualize & query Method, Field dependenciesCollaborative ltering (co-usage)RankingGod classesPaths between classes 6 6 7. Welcome to Class-Graphtake a JARput it under ASMscan it superfastpull everything into Neo4jadd categories, indexesHave Fun http://github.com/jexp/class-graph 77 8. Welcome to Class-Graph 8 8 9. Interactive Hands-On SessionLots of tasksuse Cypher to solve them http://neo4j.org/resources/cypherbe creative, work togetherask !Server http://bit.ly/innoq-neo4jjust the beginning 9 9 10. Task: Find java.lang.Number and return it10 10 11. Task: Find java.lang.Number and return itSTARTo=node:types(name="java.lang.Number")RETURN o; 1010 12. Task: Subclasses of Number?Return just the nameOrder them alphabetically11 11 13. Task: Subclasses of Number?START n=node:types(name="java.lang.Number") MATCH nmRETURN m;Find the top 5 classes with the most members12 12 16. Task: Calculate the fan-out ofjava.lang.StringBuilderCalculate fan-inWhich class has the highest fan-outWhat about package-level? 1313 17. Task: Calculate the fan-out of java.lang.StringBuilderSTART o=node:types(name="j.l.StringBuilder")MATCH o-[:FIELD_OF]->f-[:FIELD_TYPE]->tf,o-[:METHOD_OF]->m-[:PARAM_TYPE]->tp,m-[:RETURN_TYPE]->trRETURN o,count(distinct tf) + count(distinct tp) + count(distinct tr) as fan_out;Calculate fan-inWhich class has the highest fan-outWhat about package-level? 13 13 18. Task: Find longest Inheritance Path14 14 19. Task: Find longest Inheritance Pathstartc=node:types(name="java.lang.Object")matchpath=p