awsdocs / aws-doc-sdk-examples
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 7,263 units with 121,050 lines of code in units (62.2% of code).
    • 20 very long units (3,204 lines of code)
    • 201 long units (12,675 lines of code)
    • 1,710 medium size units (50,789 lines of code)
    • 2,547 small units (39,168 lines of code)
    • 2,785 very small units (15,214 lines of code)
2% | 10% | 41% | 32% | 12%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cs8% | 16% | 37% | 28% | 9%
cpp8% | 15% | 67% | 6% | 1%
java1% | 6% | 43% | 37% | 11%
kt3% | 3% | 18% | 58% | 16%
py1% | 17% | 31% | 30% | 19%
ts8% | 60% | 12% | 10% | 7%
go<1% | 8% | 53% | 27% | 10%
rb0% | 9% | 50% | 26% | 13%
js0% | 5% | 21% | 29% | 43%
php0% | 4% | 58% | 27% | 9%
rs0% | 0% | 57% | 16% | 26%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
dotnetv38% | 16% | 37% | 28% | 9%
cpp8% | 15% | 67% | 6% | 1%
javav21% | 5% | 39% | 41% | 11%
kotlin3% | 3% | 18% | 58% | 16%
python1% | 19% | 29% | 29% | 19%
java<1% | 9% | 51% | 26% | 12%
resources10% | 65% | 11% | 5% | 6%
go<1% | 6% | 49% | 33% | 9%
lambda_functions5% | 0% | 41% | 35% | 18%
gov20% | 16% | 63% | 8% | 11%
ruby0% | 9% | 50% | 25% | 13%
javascript0% | 16% | 28% | 15% | 38%
php0% | 4% | 58% | 27% | 9%
typescript0% | 23% | 28% | 25% | 21%
scripts0% | 12% | 35% | 33% | 18%
javascriptv30% | 0% | 26% | 24% | 49%
rust_dev_preview0% | 0% | 57% | 16% | 26%
tools0% | 0% | 0% | 100% | 0%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
bool AwsDoc::ACM::DescribeCertificate()
in cpp/example_code/acm/acm_basic_operations.cpp
454 90 2
public static async Task LoadData()
in dotnetv3/dynamodb/LowLevelLocalSecondaryIndexExample/LowLevelLocalSecondaryIndexExample.cs
365 1 1
static void Main()
in dotnetv3/dynamodb/GettingStarted/00_Main.cs
254 46 0
int main()
in cpp/example_code/acm/acm_basic_operations.cpp
233 42 2
suspend fun createMediaJob()
in kotlin/services/mediaconvert/src/main/kotlin/com/kotlin/mediaconvert/CreateJob.kt
216 6 3
public static String createMediaJob()
in javav2/example_code/mediaconvert/src/main/java/com/example/mediaconvert/CreateJob.java
136 3 3
public static void loadData()
in java/example_code/dynamodb/src/main/java/com/amazonaws/codesamples/lowlevel/LowLevelLocalSecondaryIndexExample.java
123 1 0
constructor()
in resources/cdk/javascript_example_code_transcribe_demo/setup.ts
121 1 3
fun createOutput()
in kotlin/services/mediaconvert/src/main/kotlin/com/kotlin/mediaconvert/CreateJob.kt
119 4 8
public static void createFleet()
in javav2/example_code/emr/src/main/java/aws/example/emr/CreateEmrFleet.java
111 2 1
public static void createTable()
in javav2/example_code/dynamodb/src/main/java/com/example/dynamodb/EnhancedScanRecordsWithExpression.java
111 2 2
def usage_demo()
in python/example_code/iam/iam_basics/user_wrapper.py
110 13 0
int main()
in cpp/example_code/kinesis/put_get_records.cpp
108 13 2
public async Task CleanUpResourcesTest()
in dotnetv3/IAM/IAMUserExample/IAMUserExampleTests/IAMUserTests.cs
108 8 0
static void Main()
in dotnetv3/dynamodb/FromSQL/CreateIndexExample/CreateIndexExample/CreateIndex.cs
107 20 1
public static async Task AddIndexAsync()
in dotnetv3/dynamodb/FromSQL/CreateIndexExample/CreateIndexExample/CreateIndex.cs
107 8 7
public static async Task CreateTable()
in dotnetv3/dynamodb/LowLevelGlobalSecondaryIndexExample/LowLevelGlobalSecondaryIndexExample.cs
107 1 1
def create_app()
in python/cross_service/dynamodb_item_tracker/app.py
106 16 1
func main()
in go/cloudtrail/cloudtrailOps.go
104 22 0
def apply_database_permissions()
in lambda_functions/secretsmanager/RDSSQLServer-Multiuser.py
104 28 3