SlideShare ist ein Scribd-Unternehmen logo
1 von 27
Downloaden Sie, um offline zu lesen
Neo4j in Action
Software Metrics
  Michael Hunger (@mesirii)

                              1

                                  1
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
Code City




            3

                3
Class Diagram is a Graph




                           4

                               4
SonarJ




         5

             5
But there is more
๏Visualize & query Method, Field
   dependencies
๏Collaborative filtering (co-usage)
๏Ranking
๏God classes
๏Paths between classes

                                     6

                                         6
Welcome to Class-Graph
๏take a JAR
๏put it under ASM
๏scan it superfast
๏pull everything into Neo4j
๏add categories, indexes
๏Have Fun

     http://github.com/jexp/class-graph   7

                                              7
Welcome to Class-Graph




                         8

                             8
Interactive Hands-On Session
๏Lots of tasks
๏use Cypher to solve them
   http://neo4j.org/resources/cypher
๏be creative, work together
๏ask !
๏Server http://bit.ly/innoq-neo4j
๏just the beginning
                                       9

                                           9
Task: Find java.lang.Number and return it




                                            10

                                                 10
Task: Find java.lang.Number and return it


START o=node:types(name="java.lang.Number") 
RETURN o;




                                             10

                                                  10
Task: Subclasses of Number?




•Return just the name
•Order them alphabetically

                              11

                                   11
Task: Subclasses of Number?


START n=node:types(name="java.lang.Number") 
 MATCH n<-[:SUPER_TYPE]-s
 RETURN s.name
 ORDER BY s.name;



•Return just the name
•Order them alphabetically

                                       11

                                               11
Task: Which Methods does it have / how many




•Find the top 5 classes with the most members


                                                12

                                                     12
Task: Which Methods does it have / how many


START n=node:types(name="java.lang.Number") 
MATCH n-[:METHOD_OF|FIELD_OF]->m
RETURN m;




•Find the top 5 classes with the most members


                                                12

                                                     12
Task: Calculate the fan-out of
java.lang.StringBuilder




•Calculate fan-in
•Which class has the highest fan-out
•What about package-level?             13

                                            13
Task: Calculate the fan-out of
 java.lang.StringBuilder
START 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]->tr
RETURN o,count(distinct tf)
       + count(distinct tp)
       + count(distinct tr) as fan_out;

•Calculate fan-in
•Which class has the highest fan-out
•What about package-level?             13

                                               13
Task: Find longest Inheritance Path




                                      14

                                           14
Task: Find longest Inheritance Path


start c=node:types(name="java.lang.Object") 
match path=p<-[:SUPER_TYPE*]-c 
return extract(n in nodes(path) : n.name),
length(path) as len
order by len desc 
limit 5;




                                       14

                                               14
Task: Find the class that used IOException
most often




                                             15

                                                  15
Task: Find the class that used IOException
most often

START ex=node:types(name="java.io.IOException"
MATCH ex<-[:THROWS]-m<-[:METHOD_OF]-c
RETURN c, count(*)
ORDER BY count(*)
LIMIT 5;




                                             15

                                                  15
Task: Which other classes did classes that
 threw IOException use most often?




•What could be a source of IOExceptions
                                              16

                                                   16
Task: Which other classes did classes that
 threw IOException use most often?
START ex=node:types(name="java.io.IOException")
MATCH ex<-[:THROWS]-m<-[:METHOD_OF]-c,
      mbr<-[:METHOD_OF|FIELD_OF]-c,
      mbr-[:FIELD_TYPE|PARAM_TYPE|
            RETURN_TYPE|THROWS]->other_type
WHERE other_type.name =~ /.+[.].+/
RETURN other_type.name, count(*)
ORDER BY count(*) desc
LIMIT 10;
•What could be a source of IOExceptions
                                              16

                                                   16
Task: Find a class you like and add a field with
your name and some type




                                            17

                                                  17
Task: Find a class you like and add a field with
 your name and some type
START c=node:types(name="void"),
 t=node:types(name="java.lang.reflect.Proxy") 
CREATE c-[:FIELD_OF]->(field {name:“Michael“})
       -[:FIELD_TYPE]->t;




                                             17

                                                   17
Task: Delete the most annoying class and all its
methods, fields and their relationships




                                           18

                                                   18
Task: Delete the most annoying class and all its
 methods, fields and their relationships
START c=node:types(name="java.awt.List"),
MATCH c-[r1:FIELD_OF|METHOD_OF]->mbr-[r2]-()
      c-[r]-()
DELETE c,mbr,r1,r2,r;




                                            18

                                                    18

Weitere ähnliche Inhalte

Was ist angesagt?

Rails Code Club 2 @ Taipei
Rails Code Club 2 @ TaipeiRails Code Club 2 @ Taipei
Rails Code Club 2 @ Taipei
Bruce Li
 
High Wizardry in the Land of Scala
High Wizardry in the Land of ScalaHigh Wizardry in the Land of Scala
High Wizardry in the Land of Scala
djspiewak
 
C h 04 oop_inheritance
C h 04 oop_inheritanceC h 04 oop_inheritance
C h 04 oop_inheritance
shatha00
 

Was ist angesagt? (20)

Java OOP Programming language (Part 5) - Inheritance
Java OOP Programming language (Part 5) - InheritanceJava OOP Programming language (Part 5) - Inheritance
Java OOP Programming language (Part 5) - Inheritance
 
Postobjektové programovanie v Ruby
Postobjektové programovanie v RubyPostobjektové programovanie v Ruby
Postobjektové programovanie v Ruby
 
Introduction To Scala
Introduction To ScalaIntroduction To Scala
Introduction To Scala
 
Rails Code Club 2 @ Taipei
Rails Code Club 2 @ TaipeiRails Code Club 2 @ Taipei
Rails Code Club 2 @ Taipei
 
Spsl v unit - final
Spsl v unit - finalSpsl v unit - final
Spsl v unit - final
 
Scala Back to Basics: Type Classes
Scala Back to Basics: Type ClassesScala Back to Basics: Type Classes
Scala Back to Basics: Type Classes
 
High Wizardry in the Land of Scala
High Wizardry in the Land of ScalaHigh Wizardry in the Land of Scala
High Wizardry in the Land of Scala
 
Metaprogramming in Ruby
Metaprogramming in RubyMetaprogramming in Ruby
Metaprogramming in Ruby
 
04. Review OOP with Java
04. Review OOP with Java04. Review OOP with Java
04. Review OOP with Java
 
C h 04 oop_inheritance
C h 04 oop_inheritanceC h 04 oop_inheritance
C h 04 oop_inheritance
 
Java for beginners
Java for beginnersJava for beginners
Java for beginners
 
Scala fundamentals
Scala fundamentalsScala fundamentals
Scala fundamentals
 
The Ring programming language version 1.6 book - Part 34 of 189
The Ring programming language version 1.6 book - Part 34 of 189The Ring programming language version 1.6 book - Part 34 of 189
The Ring programming language version 1.6 book - Part 34 of 189
 
Python unit 3 m.sc cs
Python unit 3 m.sc csPython unit 3 m.sc cs
Python unit 3 m.sc cs
 
The Ring programming language version 1.8 book - Part 38 of 202
The Ring programming language version 1.8 book - Part 38 of 202The Ring programming language version 1.8 book - Part 38 of 202
The Ring programming language version 1.8 book - Part 38 of 202
 
Scala cheatsheet
Scala cheatsheetScala cheatsheet
Scala cheatsheet
 
C# features through examples
C# features through examplesC# features through examples
C# features through examples
 
OOP with Java - continued
OOP with Java - continuedOOP with Java - continued
OOP with Java - continued
 
Scala - brief intro
Scala - brief introScala - brief intro
Scala - brief intro
 
Python programming : Classes objects
Python programming : Classes objectsPython programming : Classes objects
Python programming : Classes objects
 

Andere mochten auch

PMCD Fall 2015 Newsletter
PMCD Fall 2015 NewsletterPMCD Fall 2015 Newsletter
PMCD Fall 2015 Newsletter
Sandeep Raju
 
Introduction To Work Item Customisation
Introduction To Work Item CustomisationIntroduction To Work Item Customisation
Introduction To Work Item Customisation
wbarthol
 
Security best practices for hyper v and server virtualisation [svr307]
Security best practices for hyper v and server virtualisation [svr307]Security best practices for hyper v and server virtualisation [svr307]
Security best practices for hyper v and server virtualisation [svr307]
Louis Göhl
 
Windows Server 2008 R2 Hyper-V SP1 Component Architecture
Windows Server 2008 R2 Hyper-V SP1 Component Architecture Windows Server 2008 R2 Hyper-V SP1 Component Architecture
Windows Server 2008 R2 Hyper-V SP1 Component Architecture
Tũi Wichets
 
Understanding AzMan In Hyper-V
Understanding AzMan In Hyper-VUnderstanding AzMan In Hyper-V
Understanding AzMan In Hyper-V
Lai Yoong Seng
 
Getting Started With The TFS API
Getting Started With The TFS APIGetting Started With The TFS API
Getting Started With The TFS API
wbarthol
 
Storage and hyper v - the choices you can make and the things you need to kno...
Storage and hyper v - the choices you can make and the things you need to kno...Storage and hyper v - the choices you can make and the things you need to kno...
Storage and hyper v - the choices you can make and the things you need to kno...
Louis Göhl
 
Hyper-V Best Practices & Tips and Tricks
Hyper-V Best Practices & Tips and TricksHyper-V Best Practices & Tips and Tricks
Hyper-V Best Practices & Tips and Tricks
Amit Gatenyo
 

Andere mochten auch (20)

Network analysis with Hadoop and Neo4j
Network analysis with Hadoop and Neo4jNetwork analysis with Hadoop and Neo4j
Network analysis with Hadoop and Neo4j
 
PMCD Fall 2015 Newsletter
PMCD Fall 2015 NewsletterPMCD Fall 2015 Newsletter
PMCD Fall 2015 Newsletter
 
Unidirectional Security, Andrew Ginter of Waterfall Security
Unidirectional Security, Andrew Ginter of Waterfall Security Unidirectional Security, Andrew Ginter of Waterfall Security
Unidirectional Security, Andrew Ginter of Waterfall Security
 
Neo4j Graph Database Presentation (German)
Neo4j Graph Database Presentation (German)Neo4j Graph Database Presentation (German)
Neo4j Graph Database Presentation (German)
 
Introduction To Work Item Customisation
Introduction To Work Item CustomisationIntroduction To Work Item Customisation
Introduction To Work Item Customisation
 
Security best practices for hyper v and server virtualisation [svr307]
Security best practices for hyper v and server virtualisation [svr307]Security best practices for hyper v and server virtualisation [svr307]
Security best practices for hyper v and server virtualisation [svr307]
 
SQL and NoSQL in SQL Server
SQL and NoSQL in SQL ServerSQL and NoSQL in SQL Server
SQL and NoSQL in SQL Server
 
Windows Server 2008 R2 Hyper-V SP1 Component Architecture
Windows Server 2008 R2 Hyper-V SP1 Component Architecture Windows Server 2008 R2 Hyper-V SP1 Component Architecture
Windows Server 2008 R2 Hyper-V SP1 Component Architecture
 
Understanding AzMan In Hyper-V
Understanding AzMan In Hyper-VUnderstanding AzMan In Hyper-V
Understanding AzMan In Hyper-V
 
Rodc features
Rodc featuresRodc features
Rodc features
 
Getting Started With The TFS API
Getting Started With The TFS APIGetting Started With The TFS API
Getting Started With The TFS API
 
Storage and hyper v - the choices you can make and the things you need to kno...
Storage and hyper v - the choices you can make and the things you need to kno...Storage and hyper v - the choices you can make and the things you need to kno...
Storage and hyper v - the choices you can make and the things you need to kno...
 
Attacking Web Applications
Attacking Web ApplicationsAttacking Web Applications
Attacking Web Applications
 
Managing Hyper-V With PowerShell
Managing Hyper-V With PowerShellManaging Hyper-V With PowerShell
Managing Hyper-V With PowerShell
 
Software development manager performance appraisal
Software development manager performance appraisalSoftware development manager performance appraisal
Software development manager performance appraisal
 
Hyper-V Best Practices & Tips and Tricks
Hyper-V Best Practices & Tips and TricksHyper-V Best Practices & Tips and Tricks
Hyper-V Best Practices & Tips and Tricks
 
DeltaV Development Systems in a Virtualized Environment
DeltaV Development Systems in a Virtualized EnvironmentDeltaV Development Systems in a Virtualized Environment
DeltaV Development Systems in a Virtualized Environment
 
Master the Mystery and Marvels of DeltaV MPC
Master the Mystery and Marvels of DeltaV MPCMaster the Mystery and Marvels of DeltaV MPC
Master the Mystery and Marvels of DeltaV MPC
 
Building The Virtual Plant For DeltaV
Building The Virtual Plant For DeltaVBuilding The Virtual Plant For DeltaV
Building The Virtual Plant For DeltaV
 
Hyper V And Scvmm Best Practis
Hyper V And Scvmm Best PractisHyper V And Scvmm Best Practis
Hyper V And Scvmm Best Practis
 

Ähnlich wie Class graph neo4j and software metrics

Java 2 chapter 10 - basic oop in java
Java 2   chapter 10 - basic oop in javaJava 2   chapter 10 - basic oop in java
Java 2 chapter 10 - basic oop in java
let's go to study
 
Ruby: OOP, metaprogramming, blocks, iterators, mix-ins, duck typing. Code style
Ruby: OOP, metaprogramming, blocks, iterators, mix-ins, duck typing. Code styleRuby: OOP, metaprogramming, blocks, iterators, mix-ins, duck typing. Code style
Ruby: OOP, metaprogramming, blocks, iterators, mix-ins, duck typing. Code style
Anton Shemerey
 

Ähnlich wie Class graph neo4j and software metrics (20)

New features in jdk8 iti
New features in jdk8 itiNew features in jdk8 iti
New features in jdk8 iti
 
Java programming-examples
Java programming-examplesJava programming-examples
Java programming-examples
 
c#(loops,arrays)
c#(loops,arrays)c#(loops,arrays)
c#(loops,arrays)
 
Slides
SlidesSlides
Slides
 
Extreme Swift
Extreme SwiftExtreme Swift
Extreme Swift
 
Introduction to Scala for JCConf Taiwan
Introduction to Scala for JCConf TaiwanIntroduction to Scala for JCConf Taiwan
Introduction to Scala for JCConf Taiwan
 
Java 2 chapter 10 - basic oop in java
Java 2   chapter 10 - basic oop in javaJava 2   chapter 10 - basic oop in java
Java 2 chapter 10 - basic oop in java
 
Introducing Ruby
Introducing RubyIntroducing Ruby
Introducing Ruby
 
Polymorphism.pptx
Polymorphism.pptxPolymorphism.pptx
Polymorphism.pptx
 
Ruby: Beyond the Basics
Ruby: Beyond the BasicsRuby: Beyond the Basics
Ruby: Beyond the Basics
 
Ruby: OOP, metaprogramming, blocks, iterators, mix-ins, duck typing. Code style
Ruby: OOP, metaprogramming, blocks, iterators, mix-ins, duck typing. Code styleRuby: OOP, metaprogramming, blocks, iterators, mix-ins, duck typing. Code style
Ruby: OOP, metaprogramming, blocks, iterators, mix-ins, duck typing. Code style
 
Scala for Java Programmers
Scala for Java ProgrammersScala for Java Programmers
Scala for Java Programmers
 
Core java - baabtra
Core java - baabtraCore java - baabtra
Core java - baabtra
 
Scala ntnu
Scala ntnuScala ntnu
Scala ntnu
 
Static or Dynamic Typing? Why not both?
Static or Dynamic Typing? Why not both?Static or Dynamic Typing? Why not both?
Static or Dynamic Typing? Why not both?
 
New Features in JDK 8
New Features in JDK 8New Features in JDK 8
New Features in JDK 8
 
How to write Ruby extensions with Crystal
How to write Ruby extensions with CrystalHow to write Ruby extensions with Crystal
How to write Ruby extensions with Crystal
 
Introduction to clojure
Introduction to clojureIntroduction to clojure
Introduction to clojure
 
Adventures in TclOO
Adventures in TclOOAdventures in TclOO
Adventures in TclOO
 
CLIPS Basic Student Guide
CLIPS Basic Student GuideCLIPS Basic Student Guide
CLIPS Basic Student Guide
 

Mehr von jexp

Graphs & Neo4j - Past Present Future
Graphs & Neo4j - Past Present FutureGraphs & Neo4j - Past Present Future
Graphs & Neo4j - Past Present Future
jexp
 
Intro to Graphs and Neo4j
Intro to Graphs and Neo4jIntro to Graphs and Neo4j
Intro to Graphs and Neo4j
jexp
 

Mehr von jexp (20)

Looming Marvelous - Virtual Threads in Java Javaland.pdf
Looming Marvelous - Virtual Threads in Java Javaland.pdfLooming Marvelous - Virtual Threads in Java Javaland.pdf
Looming Marvelous - Virtual Threads in Java Javaland.pdf
 
Easing the daily grind with the awesome JDK command line tools
Easing the daily grind with the awesome JDK command line toolsEasing the daily grind with the awesome JDK command line tools
Easing the daily grind with the awesome JDK command line tools
 
Looming Marvelous - Virtual Threads in Java
Looming Marvelous - Virtual Threads in JavaLooming Marvelous - Virtual Threads in Java
Looming Marvelous - Virtual Threads in Java
 
GraphConnect 2022 - Top 10 Cypher Tuning Tips & Tricks.pptx
GraphConnect 2022 - Top 10 Cypher Tuning Tips & Tricks.pptxGraphConnect 2022 - Top 10 Cypher Tuning Tips & Tricks.pptx
GraphConnect 2022 - Top 10 Cypher Tuning Tips & Tricks.pptx
 
Neo4j Connector Apache Spark FiNCENFiles
Neo4j Connector Apache Spark FiNCENFilesNeo4j Connector Apache Spark FiNCENFiles
Neo4j Connector Apache Spark FiNCENFiles
 
How Graphs Help Investigative Journalists to Connect the Dots
How Graphs Help Investigative Journalists to Connect the DotsHow Graphs Help Investigative Journalists to Connect the Dots
How Graphs Help Investigative Journalists to Connect the Dots
 
The Home Office. Does it really work?
The Home Office. Does it really work?The Home Office. Does it really work?
The Home Office. Does it really work?
 
Polyglot Applications with GraalVM
Polyglot Applications with GraalVMPolyglot Applications with GraalVM
Polyglot Applications with GraalVM
 
Neo4j Graph Streaming Services with Apache Kafka
Neo4j Graph Streaming Services with Apache KafkaNeo4j Graph Streaming Services with Apache Kafka
Neo4j Graph Streaming Services with Apache Kafka
 
How Graph Databases efficiently store, manage and query connected data at s...
How Graph Databases efficiently  store, manage and query  connected data at s...How Graph Databases efficiently  store, manage and query  connected data at s...
How Graph Databases efficiently store, manage and query connected data at s...
 
APOC Pearls - Whirlwind Tour Through the Neo4j APOC Procedures Library
APOC Pearls - Whirlwind Tour Through the Neo4j APOC Procedures LibraryAPOC Pearls - Whirlwind Tour Through the Neo4j APOC Procedures Library
APOC Pearls - Whirlwind Tour Through the Neo4j APOC Procedures Library
 
Refactoring, 2nd Edition
Refactoring, 2nd EditionRefactoring, 2nd Edition
Refactoring, 2nd Edition
 
New Features in Neo4j 3.4 / 3.3 - Graph Algorithms, Spatial, Date-Time & Visu...
New Features in Neo4j 3.4 / 3.3 - Graph Algorithms, Spatial, Date-Time & Visu...New Features in Neo4j 3.4 / 3.3 - Graph Algorithms, Spatial, Date-Time & Visu...
New Features in Neo4j 3.4 / 3.3 - Graph Algorithms, Spatial, Date-Time & Visu...
 
GraphQL - The new "Lingua Franca" for API-Development
GraphQL - The new "Lingua Franca" for API-DevelopmentGraphQL - The new "Lingua Franca" for API-Development
GraphQL - The new "Lingua Franca" for API-Development
 
A whirlwind tour of graph databases
A whirlwind tour of graph databasesA whirlwind tour of graph databases
A whirlwind tour of graph databases
 
Practical Graph Algorithms with Neo4j
Practical Graph Algorithms with Neo4jPractical Graph Algorithms with Neo4j
Practical Graph Algorithms with Neo4j
 
A Game of Data and GraphQL
A Game of Data and GraphQLA Game of Data and GraphQL
A Game of Data and GraphQL
 
Querying Graphs with GraphQL
Querying Graphs with GraphQLQuerying Graphs with GraphQL
Querying Graphs with GraphQL
 
Graphs & Neo4j - Past Present Future
Graphs & Neo4j - Past Present FutureGraphs & Neo4j - Past Present Future
Graphs & Neo4j - Past Present Future
 
Intro to Graphs and Neo4j
Intro to Graphs and Neo4jIntro to Graphs and Neo4j
Intro to Graphs and Neo4j
 

Kürzlich hochgeladen

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Kürzlich hochgeladen (20)

Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 

Class graph neo4j and software metrics

  • 1. Neo4j in Action Software Metrics Michael Hunger (@mesirii) 1 1
  • 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 City 3 3
  • 4. Class Diagram is a Graph 4 4
  • 5. SonarJ 5 5
  • 6. But there is more ๏Visualize & query Method, Field dependencies ๏Collaborative filtering (co-usage) ๏Ranking ๏God classes ๏Paths between classes 6 6
  • 7. Welcome to Class-Graph ๏take a JAR ๏put it under ASM ๏scan it superfast ๏pull everything into Neo4j ๏add categories, indexes ๏Have Fun http://github.com/jexp/class-graph 7 7
  • 9. Interactive Hands-On Session ๏Lots of tasks ๏use Cypher to solve them http://neo4j.org/resources/cypher ๏be creative, work together ๏ask ! ๏Server http://bit.ly/innoq-neo4j ๏just the beginning 9 9
  • 10. Task: Find java.lang.Number and return it 10 10
  • 11. Task: Find java.lang.Number and return it START o=node:types(name="java.lang.Number")  RETURN o; 10 10
  • 12. Task: Subclasses of Number? •Return just the name •Order them alphabetically 11 11
  • 13. Task: Subclasses of Number? START n=node:types(name="java.lang.Number")  MATCH n<-[:SUPER_TYPE]-s RETURN s.name ORDER BY s.name; •Return just the name •Order them alphabetically 11 11
  • 14. Task: Which Methods does it have / how many •Find the top 5 classes with the most members 12 12
  • 15. Task: Which Methods does it have / how many START n=node:types(name="java.lang.Number")  MATCH n-[:METHOD_OF|FIELD_OF]->m RETURN m; •Find the top 5 classes with the most members 12 12
  • 16. Task: Calculate the fan-out of java.lang.StringBuilder •Calculate fan-in •Which class has the highest fan-out •What about package-level? 13 13
  • 17. Task: Calculate the fan-out of java.lang.StringBuilder START 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]->tr RETURN o,count(distinct tf) + count(distinct tp) + count(distinct tr) as fan_out; •Calculate fan-in •Which class has the highest fan-out •What about package-level? 13 13
  • 18. Task: Find longest Inheritance Path 14 14
  • 19. Task: Find longest Inheritance Path start c=node:types(name="java.lang.Object")  match path=p<-[:SUPER_TYPE*]-c  return extract(n in nodes(path) : n.name), length(path) as len order by len desc  limit 5; 14 14
  • 20. Task: Find the class that used IOException most often 15 15
  • 21. Task: Find the class that used IOException most often START ex=node:types(name="java.io.IOException" MATCH ex<-[:THROWS]-m<-[:METHOD_OF]-c RETURN c, count(*) ORDER BY count(*) LIMIT 5; 15 15
  • 22. Task: Which other classes did classes that threw IOException use most often? •What could be a source of IOExceptions 16 16
  • 23. Task: Which other classes did classes that threw IOException use most often? START ex=node:types(name="java.io.IOException") MATCH ex<-[:THROWS]-m<-[:METHOD_OF]-c,  mbr<-[:METHOD_OF|FIELD_OF]-c, mbr-[:FIELD_TYPE|PARAM_TYPE| RETURN_TYPE|THROWS]->other_type WHERE other_type.name =~ /.+[.].+/ RETURN other_type.name, count(*) ORDER BY count(*) desc LIMIT 10; •What could be a source of IOExceptions 16 16
  • 24. Task: Find a class you like and add a field with your name and some type 17 17
  • 25. Task: Find a class you like and add a field with your name and some type START c=node:types(name="void"), t=node:types(name="java.lang.reflect.Proxy")  CREATE c-[:FIELD_OF]->(field {name:“Michael“}) -[:FIELD_TYPE]->t; 17 17
  • 26. Task: Delete the most annoying class and all its methods, fields and their relationships 18 18
  • 27. Task: Delete the most annoying class and all its methods, fields and their relationships START c=node:types(name="java.awt.List"), MATCH c-[r1:FIELD_OF|METHOD_OF]->mbr-[r2]-() c-[r]-() DELETE c,mbr,r1,r2,r; 18 18