aws-samples / aws-serverless-ecommerce-platform
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 96 units with 1,710 lines of code in units (20.4% of code).
    • 1 very long units (187 lines of code)
    • 2 long units (118 lines of code)
    • 23 medium size units (656 lines of code)
    • 32 small units (522 lines of code)
    • 38 very small units (227 lines of code)
10% | 6% | 38% | 30% | 13%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
ts49% | 0% | 6% | 44% | 0%
py0% | 8% | 47% | 26% | 17%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
payment-3p49% | 0% | 6% | 44% | 0%
delivery0% | 37% | 49% | 10% | 2%
shared0% | 28% | 21% | 20% | 29%
orders0% | 0% | 73% | 17% | 9%
warehouse0% | 0% | 66% | 22% | 11%
products0% | 0% | 40% | 55% | 4%
platform0% | 0% | 30% | 28% | 40%
delivery-pricing0% | 0% | 75% | 0% | 25%
payment0% | 0% | 15% | 50% | 34%
users0% | 0% | 0% | 94% | 5%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
constructor()
in payment-3p/lib/payment-3p-stack.ts
187 1 3
def process_record()
in delivery/src/table_update/main.py
60 8 1
def ddb_to_event()
in shared/src/ecom/ecom/eventbridge.py
58 14 5
def handler()
in orders/src/on_events/main.py
49 9 2
def handler()
in orders/src/create_order/main.py
46 5 2
def validate_products()
in products/src/validate/main.py
36 12 1
def on_order_modified()
in warehouse/src/on_order_events/main.py
35 8 2
def handler()
in platform/src/register/main.py
32 4 2
def update_order()
in orders/src/on_events/main.py
32 5 3
def validate_delivery()
in orders/src/create_order/main.py
31 5 1
def validate_payment()
in orders/src/create_order/main.py
31 5 1
def handler()
in delivery/src/on_package_created/main.py
30 3 2
def get_products()
in warehouse/src/table_update/main.py
28 2 1
def get_products()
in warehouse/src/on_order_events/main.py
28 2 1
def delete_products()
in warehouse/src/on_order_events/main.py
27 5 2
def get_order()
in delivery/src/on_package_created/main.py
27 2 1
def handler()
in delivery-pricing/src/pricing/main.py
24 5 2
export async function updateAmount()
in payment-3p/src/updateAmount/index.ts
23 4 3
def parse_record()
in warehouse/src/table_update/main.py
23 6 1
def save_products()
in warehouse/src/on_order_events/main.py
23 2 2