aws-samples / designing-cloud-native-microservices-on-aws
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 187 units with 1,151 lines of code in units (47.5% of code).
    • 1 very long units (237 lines of code)
    • 0 long units (0 lines of code)
    • 2 medium size units (43 lines of code)
    • 10 small units (146 lines of code)
    • 174 very small units (725 lines of code)
20% | 0% | 3% | 12% | 62%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
ts100% | 0% | 0% | 0% | 0%
java0% | 0% | 4% | 15% | 79%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
deployment/coffeeshop-cdk/lib100% | 0% | 0% | 0% | 0%
sources/coffeeshop/coffee-sls0% | 0% | 38% | 0% | 61%
sources/coffeeshop/infrastructure0% | 0% | 12% | 29% | 58%
sources/coffeeshop/orders-domain0% | 0% | 0% | 10% | 89%
sources/coffeeshop/orders-application0% | 0% | 0% | 26% | 73%
sources/coffeeshop/coffee-application0% | 0% | 0% | 24% | 75%
sources/coffeeshop/orders-web0% | 0% | 0% | 48% | 51%
sources/coffeeshop/inventory-sls0% | 0% | 0% | 37% | 62%
sources/coffeeshop/ddd-commons0% | 0% | 0% | 0% | 100%
sources/coffeeshop/coffee-domain0% | 0% | 0% | 0% | 100%
sources/coffeeshop/inventory-web0% | 0% | 0% | 0% | 100%
sources/coffeeshop/inventory-domain0% | 0% | 0% | 0% | 100%
sources/coffeeshop/service-discovery0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
constructor()
in deployment/coffeeshop-cdk/lib/coffee-shop-code-pipeline.ts
237 1 3
public void handleRequest()
in sources/coffeeshop/coffee-sls/src/main/java/solid/humank/coffeeshop/cofee/sls/orders/OrderCreatedHandler.java
22 1 3
private PublishResult putEvent()
in sources/coffeeshop/infrastructure/src/main/java/solid/humank/coffeeshop/infra/adapters/CloudWatchEventAdapter.java
21 2 1
public PutItemRequest buildPutItemRequest()
in sources/coffeeshop/infrastructure/src/main/java/solid/humank/coffeeshop/infra/repositories/orders/OrderDDBMapper.java
19 1 1
public void when()
in sources/coffeeshop/orders-domain/src/main/java/solid/humank/coffeeshop/order/models/Order.java
18 5 1
private Properties getCWEParameters()
in sources/coffeeshop/infrastructure/src/main/java/solid/humank/coffeeshop/infra/adapters/CloudWatchEventAdapter.java
16 3 0
public Response createOrder()
in sources/coffeeshop/orders-web/src/main/java/solid/humank/coffeeshop/order/controllers/OrderResource.java
15 3 1
public PutItemRequest buildPutItemRequest()
in sources/coffeeshop/infrastructure/src/main/java/solid/humank/coffeeshop/infra/repositories/coffee/CoffeeDDBMapper.java
15 1 1
public CoffeeRst make()
in sources/coffeeshop/coffee-application/src/main/java/solid/humank/coffeeshop/coffee/applications/MakeCoffeeSvc.java
15 2 1
public List translate()
in sources/coffeeshop/orders-application/src/main/java/solid/humank/coffeeshop/order/domainservices/OrderItemsTranslator.java
14 2 1
public Object handleRequest()
in sources/coffeeshop/inventory-sls/src/main/java/helloworld/App.java
12 2 2
public OrderRst()
in sources/coffeeshop/orders-application/src/main/java/solid/humank/coffeeshop/order/datacontracts/results/OrderRst.java
11 1 1
public static void Verify()
in sources/coffeeshop/orders-domain/src/main/java/solid/humank/coffeeshop/order/policies/OrderPolicy.java
11 5 1
public OrderRst establishOrder()
in sources/coffeeshop/orders-application/src/main/java/solid/humank/coffeeshop/order/applications/CreateOrderSvc.java
10 1 1
public PublishResult publishEvent()
in sources/coffeeshop/infrastructure/src/main/java/solid/humank/coffeeshop/infra/adapters/CloudWatchEventAdapter.java
10 2 1
public String writeToJsonString()
in sources/coffeeshop/ddd-commons/src/main/java/solid/humank/ddd/commons/utilities/DomainModelMapper.java
9 2 1
public T readValue()
in sources/coffeeshop/ddd-commons/src/main/java/solid/humank/ddd/commons/utilities/DomainModelMapper.java
9 2 2
public T readValue()
in sources/coffeeshop/ddd-commons/src/main/java/solid/humank/ddd/commons/utilities/DomainModelMapper.java
9 2 2
public static Order create()
in sources/coffeeshop/orders-domain/src/main/java/solid/humank/coffeeshop/order/models/Order.java
9 1 1
public void changeItem()
in sources/coffeeshop/orders-domain/src/main/java/solid/humank/coffeeshop/order/models/Order.java
9 3 1