android / connectivity-samples
Unit Size

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.
Learn more...
Unit Size Overall
  • There are 745 units with 7,387 lines of code in units (63.7% of code).
    • 1 very long units (149 lines of code)
    • 7 long units (454 lines of code)
    • 69 medium size units (2,136 lines of code)
    • 145 small units (2,137 lines of code)
    • 523 very small units (2,511 lines of code)
2% | 6% | 28% | 28% | 33%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cpp7% | 19% | 36% | 23% | 13%
java0% | 1% | 26% | 31% | 40%
h0% | 0% | 72% | 0% | 27%
kt0% | 0% | 0% | 42% | 57%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
NearbyConnectionsCpp5% | 13% | 39% | 24% | 17%
NearbyConnectionsWalkieTalkie0% | 5% | 26% | 26% | 42%
BluetoothChat0% | 0% | 35% | 27% | 37%
BluetoothLeGatt0% | 0% | 24% | 39% | 35%
BluetoothAdvertisements0% | 0% | 21% | 26% | 51%
WifiRttScan0% | 0% | 23% | 39% | 36%
BeamLargeFiles0% | 0% | 22% | 21% | 56%
NetworkConnect0% | 0% | 15% | 41% | 42%
BluetoothLeChat0% | 0% | 0% | 53% | 46%
NearbyConnectionsRockPaperScissors0% | 0% | 0% | 39% | 60%
BluetoothAdvertisementsKotlin0% | 0% | 0% | 25% | 75%
CronetKotlin0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
GLboolean gl3stubInit()
in NearbyConnectionsCpp/app/src/main/cpp/ndk_helper/gl3stub.cpp
149 105 0
void Engine::PlayGame()
in NearbyConnectionsCpp/app/src/main/cpp/NearbyNativeActivity.cpp
88 7 0
void Engine::InitUI()
in NearbyConnectionsCpp/app/src/main/cpp/NearbyNativeActivity.cpp
70 9 0
private void onStateChanged()
in NearbyConnectionsWalkieTalkie/app/src/manual/java/com/google/location/nearby/apps/walkietalkie/MainActivity.java
69 21 2
void Engine::OnAdvertiseButtonClick()
in NearbyConnectionsCpp/app/src/main/cpp/NearbyConnection.cpp
61 6 1
void JUIView::RestoreParameters()
in NearbyConnectionsCpp/app/src/main/cpp/jui_helper/JavaUI.cpp
56 20 1
void Engine::InitGoogleNearbyConnection()
in NearbyConnectionsCpp/app/src/main/cpp/NearbyConnection.cpp
56 5 0
void Engine::OnMessageReceivedCallback()
in NearbyConnectionsCpp/app/src/main/cpp/NearbyConnection.cpp
54 9 4
public void start()
in NearbyConnectionsWalkieTalkie/app/src/main/java/com/google/location/nearby/apps/walkietalkie/AudioRecorder.java
50 8 0
private void displayGattServices()
in BluetoothLeGatt/Application/src/main/java/com/example/android/bluetoothlegatt/DeviceControlActivity.java
47 4 1
protected void startDiscovering()
in NearbyConnectionsWalkieTalkie/app/src/main/java/com/google/location/nearby/apps/walkietalkie/ConnectionsActivity.java
44 2 0
public void onRangingResults()
in WifiRttScan/Application/src/main/java/com/example/android/wifirttscan/AccessPointRangingResultsActivity.java
44 5 1
public void println()
in BeamLargeFiles/Application/src/main/java/com/example/android/common/logger/LogView.java
44 9 4
public void println()
in BluetoothChat/Application/src/main/java/com/example/android/common/logger/LogView.java
44 9 4
public void handleMessage()
in BluetoothChat/Application/src/main/java/com/example/android/bluetoothchat/BluetoothChatFragment.java
43 12 1
private Animator createAnimator()
in NearbyConnectionsWalkieTalkie/app/src/manual/java/com/google/location/nearby/apps/walkietalkie/MainActivity.java
42 4 1
private Animator createAnimator()
in NearbyConnectionsWalkieTalkie/app/src/automatic/java/com/google/location/nearby/apps/walkietalkie/MainActivity.java
42 4 1
void JUIDialog::RestoreParameters()
in NearbyConnectionsCpp/app/src/main/cpp/jui_helper/JavaUI_Dialog.cpp
42 10 1
public void addView()
in NearbyConnectionsCpp/app/src/main/java/com/sample/helper/JUIHelper.java
42 7 2
public PopupWindow createPopupWindow()
in NearbyConnectionsCpp/app/src/main/java/com/sample/helper/JUIHelper.java
42 6 1