The distribution of size of units (measured in lines of code).
Intro
Unit size measurements show the distribution of size of units of code (methods, functions...).
Units are classified in four categories based on their size (lines of code): 1-20 (small units), 20-50 (medium size units), 51-100 (long units), 101+ (very long units).
You should aim at keeping units small (< 20 lines). Long units may become "bloaters", code that have increased to such gargantuan proportions that they are hard to work with.
"If you have to spend effort into looking at a fragment of code to figure out what it's doing, then you should extract it into a function and name the function after that 'what'."
"Use common sense, stick to small function sizes in most instances but don't be dogmatic about it if you have a genuinely good reason to make an unusually big function."
"All other things being equal, a shorter method is easier to read, easier to understand, and easier to troubleshoot. Refactor long methods into smaller methods if you can."
"The first rule of functions is that they should be small. The second rule of functions is that they should be smaller than that. Functions should not be 100 lines long. Functions should hardly ever be 20 lines long."
Unit Size Overall
There are 14,838 units with 118,240 lines of code in units (59.2% of code).
private void formatDetailedStats() in src/application/org.openjdk.jmc.joverflow/src/main/java/org/openjdk/jmc/joverflow/batch/ReportFormatter.java
322
31
3
public static String translate() in src/core/org.openjdk.jmc.flightrecorder/src/main/java/org/openjdk/jmc/flightrecorder/parser/synthetic/OracleJdkTypeIDsPre11.java
201
97
1
static IItemFactory createItemFactory() in src/core/org.openjdk.jmc.flightrecorder/src/main/java/org/openjdk/jmc/flightrecorder/internal/parser/ItemBuilder.java
166
19
2
public AncestorViewer() in src/application/org.openjdk.jmc.joverflow.ui/src/main/java/org/openjdk/jmc/joverflow/ui/viewers/AncestorViewer.java
156
13
2
private void doRead() in src/application/org.openjdk.jmc.joverflow/src/main/java/org/openjdk/jmc/joverflow/heap/parser/HprofReader.java
149
36
0
public HeapStats calculate() in src/application/org.openjdk.jmc.joverflow/src/main/java/org/openjdk/jmc/joverflow/stats/OverallStatsCalculator.java
public ClusterGroupViewer() in src/application/org.openjdk.jmc.joverflow.ui/src/main/java/org/openjdk/jmc/joverflow/ui/viewers/ClusterGroupViewer.java
133
13
2
public CombinedChartSectionPart() in src/application/org.openjdk.jmc.rjmx.ui/src/main/java/org/openjdk/jmc/rjmx/ui/internal/CombinedChartSectionPart.java
private void addListeners() in src/application/org.openjdk.jmc.flightrecorder.ui/src/main/java/org/openjdk/jmc/flightrecorder/ui/common/JComponentNavigator.java
110
21
0
private void readHeapDump() in src/application/org.openjdk.jmc.joverflow/src/main/java/org/openjdk/jmc/joverflow/heap/parser/HprofReader.java
110
19
1
public FilterEditor() in src/application/org.openjdk.jmc.ui/src/main/java/org/openjdk/jmc/ui/misc/FilterEditor.java
109
15
7
public static Color getColor() in src/application/org.openjdk.jmc.flightrecorder.ui/src/main/java/org/openjdk/jmc/flightrecorder/ui/common/TypeLabelProvider.java
102
49
1
private IResult getResult() in src/core/org.openjdk.jmc.flightrecorder.rules.jdk/src/main/java/org/openjdk/jmc/flightrecorder/rules/jdk/compilation/CodeCacheRule.java
101
11
3
protected void scanObjectsFromRootObj() in src/application/org.openjdk.jmc.joverflow/src/main/java/org/openjdk/jmc/joverflow/stats/BreadthFirstHeapScanner.java
101
21
1
private GcInfoHolder getMaxFreedWindow() in src/core/org.openjdk.jmc.flightrecorder.rules.jdk/src/main/java/org/openjdk/jmc/flightrecorder/rules/jdk/memory/GcFreedRatioRule.java