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 257 units with 2,264 lines of code in units (73.9% of code).
public void onActivityCreated() in AppRestrictions/Application/src/main/java/com/example/android/apprestrictions/CustomRestrictionsFragment.java
62
10
1
private void setChromeRestrictions() in BasicManagedProfile/Application/src/main/java/com/example/android/basicmanagedprofile/BasicManagedProfileFragment.java
46
3
0
public void println() in NfcProvisioning/Application/src/main/java/com/example/android/common/logger/LogView.java
44
9
4
public void println() in AppRestrictionSchema/Application/src/main/java/com/example/android/common/logger/LogView.java
44
9
4
public void onTextChanged() in NfcProvisioning/Application/src/main/java/com/example/android/nfcprovisioning/NfcProvisioningFragment.java
private void loadRestrictions() in AppRestrictionEnforcer/Application/src/main/java/com/example/android/apprestrictionenforcer/AppRestrictionEnforcerFragment.java
37
10
1
private void createRestrictions() in AppRestrictions/Application/src/main/java/com/example/android/apprestrictions/GetRestrictionsReceiver.java
35
9
3
private void setAppEnabled() in BasicManagedProfile/Application/src/main/java/com/example/android/basicmanagedprofile/BasicManagedProfileFragment.java
35
7
2
protected void onCreate() in AppRestrictionEnforcer/Application/src/main/java/com/example/android/apprestrictionenforcer/MainActivity.java
35
7
1
private void updateItems() in AppRestrictionSchema/Application/src/main/java/com/example/android/apprestrictionschema/AppRestrictionSchemaFragment.java
34
10
1
protected void onResume() in AppRestrictions/Application/src/main/java/com/example/android/apprestrictions/MainActivity.java
33
8
0
private void updateUi() in AppRestrictionEnforcer/Application/src/main/java/com/example/android/apprestrictionenforcer/StatusFragment.java
public void onClick() in BasicManagedProfile/Application/src/main/java/com/example/android/basicmanagedprofile/BasicManagedProfileFragment.java
29
7
1
private void provisionManagedProfile() in BasicManagedProfile/Application/src/main/java/com/example/android/basicmanagedprofile/SetupProfileFragment.java
27
4
0
private void resolveRestrictions() in AppRestrictionSchema/Application/src/main/java/com/example/android/apprestrictionschema/AppRestrictionSchemaFragment.java
24
8
0
public View inflateViews() in NfcProvisioning/Application/src/main/java/com/example/android/common/logger/LogFragment.java
23
1
0
private boolean isApplicationEnabled() in BasicManagedProfile/Application/src/main/java/com/example/android/basicmanagedprofile/BasicManagedProfileFragment.java
23
4
1
public View inflateViews() in AppRestrictionSchema/Application/src/main/java/com/example/android/common/logger/LogFragment.java