Skip to content

Latest commit

 

History

History
1517 lines (1439 loc) · 33.5 KB

File metadata and controls

1517 lines (1439 loc) · 33.5 KB

Object Oriented Design Quality Metrics for Java with Neo4j


References

Artifacts

Table 1

  • List all the artifacts this notebook is based on
artifactName packages types
0 axon-disruptor-4.7.5.jar 1 22
1 axon-eventsourcing-4.7.5.jar 9 130
2 axon-test-4.7.5.jar 8 85
3 axon-messaging-4.7.5.jar 61 729
4 axon-modelling-4.7.5.jar 10 149
5 axon-configuration-4.7.5.jar 1 39

Incoming Dependencies

Incoming dependencies are also denoted as "Fan-in", "Afferent Couplings" or "in-degree". These are the ones that use the listed package.

If these packages get changed, the incoming dependencies might be affected by the change. The more incoming dependencies, the harder it gets to change the code without the need to adapt the dependent code (“rigid code”). Even worse, it might affect the behavior of the dependent code in an unwanted way (“fragile code”).

Table 2

  • Show the top 20 packages with the most incoming dependencies
  • Set the "incomingDependencies" properties on Package nodes.
packageName incomingDependencies incomingDependenciesWeight incomingDependentTypes incomingDependentInterfaces incomingDependentPackages incomingDependentArtifacts
0 org.axonframework.messaging 8245 31931 304 64 50 6
1 org.axonframework.eventhandling 4324 27485 277 52 44 5
2 org.axonframework.commandhandling 1460 6484 119 18 18 6
3 org.axonframework.serialization 1057 5520 124 15 30 4
4 org.axonframework.messaging.annotation 1008 5191 146 18 25 6
5 org.axonframework.common 858 2003 308 12 74 6
6 org.axonframework.common.transaction 276 1060 67 5 24 4
7 org.axonframework.messaging.unitofwork 246 1367 78 5 34 6
8 org.axonframework.modelling.saga 242 1482 57 11 10 3
9 org.axonframework.eventsourcing.eventstore.jdbc 218 1404 26 14 2 1
10 org.axonframework.modelling.command 213 824 71 8 10 5
11 org.axonframework.monitoring 189 641 39 6 10 4
12 org.axonframework.queryhandling 175 935 47 10 9 2
13 org.axonframework.tracing 173 712 65 4 16 4
14 org.axonframework.eventsourcing.eventstore 166 805 59 5 10 4
15 org.axonframework.deadline 159 1331 32 8 11 4
16 org.axonframework.messaging.deadletter 135 978 28 7 5 2
17 org.axonframework.eventsourcing 128 630 40 6 5 4
18 org.axonframework.config 115 1483 34 0 1 1
19 org.axonframework.commandhandling.gateway 101 409 35 1 3 3

Outgoing Dependencies

Outcoming dependencies are also denoted as "Fan-out", "Efferent Couplings" or "out-degree". These are the ones that are used by the listed package.

Code from other packages and libraries you’re depending on (outgoing) might change over time. The more outgoing changes, the more likely and frequently code changes are needed. This involves time and effort which can be reduced by automation of tests and version updates. Automated tests are crucial to reveal updates, that change the behavior of the code unexpectedly (“fragile code”). As soon as more effort is required, keeping up becomes difficult (“rigid code”). Not being able to use a newer version might not only restrict features, it can get problematic if there are security issues. This might force you to take “fast but ugly” solutions into account which further increases technical dept.

Table 3

  • Show the top 20 packages with the most outgoing dependencies
  • Set the "outgoingDependencies" properties on Package nodes.
packageName outgoingDependencies outgoingDependentTypes outgoingDependentInterfaces outgoingDependentPackages outgoingDependentArtifacts outgoingDependenciesWeight
0 org.axonframework.config 7942 212 84 46 5 34762
1 org.axonframework.eventhandling 1545 151 54 16 1 7714
2 org.axonframework.disruptor.commandhandling 1419 85 31 14 4 7130
3 org.axonframework.test.saga 1375 79 26 17 3 4837
4 org.axonframework.eventsourcing.eventstore.jdbc 1340 51 27 11 3 8129
5 org.axonframework.queryhandling 1108 78 28 11 1 6955
6 org.axonframework.eventhandling.pooled 1022 57 26 12 1 5590
7 org.axonframework.eventsourcing 976 91 31 16 3 4142
8 org.axonframework.test.aggregate 859 64 33 16 4 3578
9 org.axonframework.commandhandling 642 70 28 9 1 2295
10 org.axonframework.modelling.command 631 79 28 15 2 2630
11 org.axonframework.commandhandling.distributed 603 67 23 11 1 2368
12 org.axonframework.eventsourcing.eventstore 603 64 25 16 3 2501
13 org.axonframework.modelling.command.inspection 525 63 23 10 2 2601
14 org.axonframework.deadline.quartz 481 38 18 10 1 2187
15 org.axonframework.commandhandling.gateway 447 58 11 10 1 1622
16 org.axonframework.modelling.saga 386 58 21 9 2 1799
17 org.axonframework.eventsourcing.eventstore.leg... 375 47 17 15 2 1870
18 org.axonframework.deadline.jobrunr 348 31 15 8 1 1611
19 org.axonframework.deadline 347 43 21 8 1 1281

Instability

$$ Instability = \frac{Outgoing:Dependencies}{Outgoing:Dependencies + Incoming:Dependencies} $$

Instability is expressed as the ratio of the number of outgoing dependencies of a module (i.e., the number of packages that depend on it) to the total number of dependencies (i.e., the sum of incoming and outgoing dependencies).

Small values near zero indicate low Instability. With no outgoing but some incoming dependencies the Instability is zero which is denoted as maximally stable. Such code units are more rigid and difficult to change without impacting other parts of the system. If they are changed less because of that, they are considered stable.

Conversely, high values approaching one indicate high Instability. With some outgoing dependencies but no incoming ones the Instability is denoted as maximally unstable. Such code units are easier to change without affecting other modules, making them more flexible and less prone to cascading changes throughout the system. If they are changed more often because of that, they are considered unstable.

Table 4

  • Show the top 20 packages with the lowest Instability
p.fqn p.name instability instabilityTypes instabilityInterfaces instabilityPackages instabilityArtifacts p.outgoingDependencies p.incomingDependencies p.outgoingDependentTypes p.incomingDependentTypes p.outgoingDependentInterfaces p.incomingDependentInterfaces p.outgoingDependentPackages p.incomingDependentPackages p.outgoingDependentArtifacts p.incomingDependentArtifacts
0 org.axonframework.messaging messaging 0.013756 0.092537 0.189873 0.107143 0.142857 115 8245 31 304 15 64 6 50 1 6
1 org.axonframework.common.transaction transaction 0.021277 0.056338 0.000000 0.040000 0.200000 6 276 4 67 0 5 1 24 1 4
2 org.axonframework.common common 0.026107 0.046440 0.000000 0.013333 0.142857 23 858 15 308 0 12 1 74 1 6
3 org.axonframework.monitoring monitoring 0.100000 0.152174 0.333333 0.230769 0.200000 21 189 7 39 3 6 3 10 1 4
4 org.axonframework.eventhandling.scheduling scheduling 0.111111 0.166667 0.000000 0.250000 0.250000 2 16 2 10 0 2 2 6 1 3
5 org.axonframework.common.annotation annotation 0.120000 0.120000 0.000000 0.166667 0.250000 3 22 3 22 0 0 2 10 1 3
6 org.axonframework.serialization serialization 0.138549 0.261905 0.318182 0.230769 0.200000 170 1057 44 124 7 15 9 30 1 4
7 org.axonframework.lifecycle lifecycle 0.138889 0.259259 0.000000 0.214286 0.250000 10 62 7 20 0 3 3 11 1 3
8 org.axonframework.common.stream stream 0.147059 0.166667 0.000000 0.125000 0.250000 5 29 3 15 0 2 1 7 1 3
9 org.axonframework.messaging.annotation annotation 0.229947 0.314554 0.419355 0.218750 0.142857 301 1008 67 146 13 18 7 25 1 6
10 org.axonframework.eventhandling eventhandling 0.263248 0.352804 0.509434 0.266667 0.166667 1545 4324 151 277 54 52 16 44 1 5
11 org.axonframework.common.jpa jpa 0.272727 0.250000 1.000000 0.300000 0.200000 6 16 5 15 2 0 3 7 1 4
12 org.axonframework.common.legacyjpa legacyjpa 0.300000 0.277778 1.000000 0.333333 0.250000 6 14 5 13 2 0 3 6 1 3
13 org.axonframework.commandhandling commandhandling 0.305423 0.370370 0.608696 0.333333 0.142857 642 1460 70 119 28 18 9 18 1 6
14 org.axonframework.serialization.upcasting upcasting 0.312500 0.083333 0.000000 0.333333 0.500000 5 11 1 11 0 1 1 2 1 1
15 org.axonframework.messaging.unitofwork unitofwork 0.333333 0.204082 0.583333 0.128205 0.142857 123 246 20 78 7 5 5 34 1 6
16 org.axonframework.common.lock lock 0.352113 0.363636 0.500000 0.222222 0.200000 25 46 12 21 2 2 2 7 1 4
17 org.axonframework.messaging.correlation correlation 0.358974 0.230769 0.400000 0.333333 0.333333 14 25 3 10 2 3 2 4 1 2
18 org.axonframework.eventhandling.tokenstore tokenstore 0.378378 0.342105 0.571429 0.333333 0.333333 42 69 13 25 4 3 4 8 1 2
19 org.axonframework.common.property property 0.394737 0.380952 1.000000 0.285714 0.333333 15 23 8 13 1 0 2 5 1 2

Abstractness

$$ Abstractness = \frac{abstract:classes:in:category}{total:number:of:classes:in:category} $$

Package Abstractness is expressed as the ratio of the number of abstract classes and interfaces to the total number of classes of a package.

Zero Abstractness means that there are no abstract types or interfaces in the package. On the other hand, a value of one means that there are only abstract types.

Table 5

  • Show the top 30 packages with the lowest Abstractness
fullQualifiedPackageName packageName abstractness numberAbstractTypes numberTypes
0 org.axonframework.eventsourcing.eventstore.leg... legacyjpa 0.000000 0 10
1 org.axonframework.commandhandling.distributed.... commandfilter 0.000000 0 7
2 org.axonframework.serialization.json json 0.000000 0 7
3 org.axonframework.serialization.xml xml 0.000000 0 7
4 org.axonframework.tracing.attributes attributes 0.000000 0 6
5 org.axonframework.serialization.converters converters 0.000000 0 5
6 org.axonframework.commandhandling.callbacks callbacks 0.000000 0 4
7 org.axonframework.deadline.quartz quartz 0.000000 0 4
8 org.axonframework.eventhandling.deadletter deadletter 0.000000 0 4
9 org.axonframework.eventhandling.scheduling.java java 0.000000 0 4
10 org.axonframework.eventhandling.tokenstore.jpa jpa 0.000000 0 4
11 org.axonframework.deadline.jobrunr jobrunr 0.000000 0 3
12 org.axonframework.eventhandling.scheduling.job... jobrunr 0.000000 0 3
13 org.axonframework.util util 0.000000 0 3
14 org.axonframework.modelling.saga.repository.le... legacyjpa 0.000000 0 3
15 org.axonframework.eventsourcing.eventstore.inm... inmemory 0.000000 0 2
16 org.axonframework.test.server server 0.000000 0 2
17 org.axonframework.eventhandling.tokenstore.inm... inmemory 0.000000 0 2
18 org.axonframework.eventhandling.tokenstore.leg... legacyjpa 0.000000 0 2
19 org.axonframework.messaging.interceptors.legac... legacyvalidation 0.000000 0 2
20 org.axonframework.modelling.command.legacyjpa legacyjpa 0.000000 0 2
21 org.axonframework.modelling.saga.repository.in... inmemory 0.000000 0 2
22 org.axonframework.common.digest digest 0.000000 0 1
23 org.axonframework.common.io io 0.000000 0 1
24 org.axonframework.eventhandling.interceptors interceptors 0.000000 0 1
25 org.axonframework.disruptor.commandhandling commandhandling 0.045455 1 22
26 org.axonframework.eventhandling.deadletter.jpa jpa 0.111111 1 9
27 org.axonframework.eventhandling.tokenstore.jdbc jdbc 0.111111 1 9
28 org.axonframework.modelling.saga.repository.jdbc jdbc 0.111111 1 9
29 org.axonframework.test.matchers matchers 0.125000 3 24

Distance from the main sequence

The main sequence is a imaginary line that represents a good compromise between Abstractness and Instability. A high distance to this line may indicate problems. For example is very stable (rigid) code with low abstractness hard to change.

Read more details on that in OO Design Quality Metrics and Calculate metrics.

Table 6

  • Show the top 20 packages with the highest distance from the "main sequence"
artifactName fullQualifiedPackageName packageName distance abstractness instability typesInPackage
0 axon-test-4.7.5 org.axonframework.test.server server 1.000000 0.000000 0.000000 2
1 axon-messaging-4.7.5 org.axonframework.common.io io 1.000000 0.000000 0.000000 1
2 axon-eventsourcing-4.7.5 org.axonframework.eventsourcing.eventstore.jdb... statements 0.727273 1.000000 0.727273 15
3 axon-messaging-4.7.5 org.axonframework.serialization serialization 0.567333 0.294118 0.138549 34
4 axon-messaging-4.7.5 org.axonframework.monitoring monitoring 0.566667 0.333333 0.100000 6
5 axon-messaging-4.7.5 org.axonframework.common.digest digest 0.500000 0.000000 0.500000 1
6 axon-messaging-4.7.5 org.axonframework.messaging.annotation annotation 0.492276 0.277778 0.229947 54
7 axon-messaging-4.7.5 org.axonframework.common.transaction transaction 0.478723 0.500000 0.021277 4
8 axon-messaging-4.7.5 org.axonframework.common.jpa jpa 0.477273 0.250000 0.272727 4
9 axon-messaging-4.7.5 org.axonframework.common.lock lock 0.466069 0.181818 0.352113 11
10 axon-messaging-4.7.5 org.axonframework.common.legacyjpa legacyjpa 0.450000 0.250000 0.300000 4
11 axon-messaging-4.7.5 org.axonframework.eventhandling.gateway gateway 0.425397 0.600000 0.825397 5
12 axon-configuration-4.7.5 org.axonframework.config config 0.421624 0.435897 0.985727 39
13 axon-test-4.7.5 org.axonframework.test.matchers matchers 0.402778 0.125000 0.472222 24
14 axon-messaging-4.7.5 org.axonframework.messaging.correlation correlation 0.391026 0.250000 0.358974 4
15 axon-messaging-4.7.5 org.axonframework.messaging messaging 0.386244 0.600000 0.013756 35
16 axon-messaging-4.7.5 org.axonframework.messaging.unitofwork unitofwork 0.380952 0.285714 0.333333 14
17 axon-messaging-4.7.5 org.axonframework.serialization.xml xml 0.377778 0.000000 0.622222 7
18 axon-messaging-4.7.5 org.axonframework.tracing tracing 0.364218 0.222222 0.413559 18
19 axon-messaging-4.7.5 org.axonframework.eventhandling.tokenstore tokenstore 0.335907 0.285714 0.378378 7

Abstractness vs. Instability Plot with "Main Sequence" line as reference

Figure 1

  • Plot Abstractness vs. Instability of all packages
  • Draw the "main sequence" as dashed green line
  • Scale the packages by the number of types they contain
  • Color the packages by their distance to the "main sequence" (blue=near, red=far)

png