android / app-bundle-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 335 units with 4,182 lines of code in units (39.7% of code).
    • 1 very long units (149 lines of code)
    • 11 long units (644 lines of code)
    • 48 medium size units (1,343 lines of code)
    • 69 small units (1,046 lines of code)
    • 206 very small units (1,000 lines of code)
3% | 15% | 32% | 25% | 23%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cpp6% | 18% | 41% | 21% | 12%
py0% | 25% | 18% | 38% | 17%
java0% | 9% | 17% | 29% | 43%
h0% | 0% | 29% | 8% | 62%
kt0% | 0% | 49% | 24% | 26%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
PlayAssetDelivery/NativeSample5% | 16% | 40% | 20% | 16%
PlayAssetDelivery/BundletoolScriptSample0% | 25% | 18% | 38% | 17%
InstantApps/multi-feature-module0% | 10% | 17% | 26% | 45%
InstantApps/analytics0% | 0% | 44% | 55% | 0%
DynamicFeatureNavigation/DSL0% | 0% | 65% | 0% | 35%
InstantApps/service0% | 0% | 0% | 44% | 55%
InstantApps/storage-api0% | 0% | 0% | 100% | 0%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
GLboolean gl3stubInit()
in PlayAssetDelivery/NativeSample/common/ndk_helper/gl3stub.cpp
149 105 0
public Animator createAnimator()
in InstantApps/multi-feature-module/app/src/main/java/com/example/android/unsplash/transition/TextResize.java
94 9 3
def extract_bundle_config()
in PlayAssetDelivery/BundletoolScriptSample/add_packs.py
65 8 4
Mat4 Mat4::Inverse()
in PlayAssetDelivery/NativeSample/common/ndk_helper/vecmath.cpp
63 8 0
def main()
in PlayAssetDelivery/BundletoolScriptSample/add_packs.py
55 8 0
bool JNIHelper::ReadFile()
in PlayAssetDelivery/NativeSample/common/ndk_helper/JNIHelper.cpp
54 7 2
GESTURE_STATE PinchDetector::Detect()
in PlayAssetDelivery/NativeSample/common/ndk_helper/gestureDetector.cpp
54 13 1
void TexturedTeapotRender::Init()
in PlayAssetDelivery/NativeSample/Teapot/src/main/cpp/TexturedTeapotRender.cpp
53 6 1
bool TeapotRenderer::LoadShaders()
in PlayAssetDelivery/NativeSample/Teapot/src/main/cpp/TeapotRenderer.cpp
52 9 3
GESTURE_STATE DragDetector::Detect()
in PlayAssetDelivery/NativeSample/common/ndk_helper/gestureDetector.cpp
52 12 1
uint32_t JNIHelper::LoadTexture()
in PlayAssetDelivery/NativeSample/common/ndk_helper/JNIHelper.cpp
51 6 4
float Interpolator::GetFormula()
in PlayAssetDelivery/NativeSample/common/ndk_helper/interpolator.cpp
51 15 5
int32_t Engine::HandleInput()
in PlayAssetDelivery/NativeSample/Teapot/src/main/cpp/TeapotNativeActivity.cpp
48 9 2
uint32_t JNIHelper::LoadCubemapTexture()
in PlayAssetDelivery/NativeSample/common/ndk_helper/JNIHelper.cpp
46 6 7
bool GLContext::InitEGLSurface()
in PlayAssetDelivery/NativeSample/common/ndk_helper/GLContext.cpp
46 3 0
jobject JNIHelper::LoadImage()
in PlayAssetDelivery/NativeSample/common/ndk_helper/JNIHelper.cpp
45 6 4
void TexturedTeapotRender::UpdateButton()
in PlayAssetDelivery/NativeSample/Teapot/src/main/cpp/TexturedTeapotRender.cpp
39 13 0
def parse_args()
in PlayAssetDelivery/BundletoolScriptSample/add_packs.py
38 1 0
bool shader::CompileShader()
in PlayAssetDelivery/NativeSample/common/ndk_helper/shader.cpp
35 6 4
protected void onCreate()
in InstantApps/multi-feature-module/detail/src/main/java/com/example/android/unsplash/DetailActivity.java
34 2 1