3
3
import lombok .extern .slf4j .Slf4j ;
4
4
5
5
/**
6
- * Clean Architecture ensures separation of concerns by organizing code,
7
- * into layers and making it scalable and maintainable.
6
+ * Clean Architecture ensures separation of concerns by organizing code, into layers and making it
7
+ * scalable and maintainable.
8
8
*
9
- * <p>In the example there are Entities (Core Models) – Product, Cart,
10
- * Order handle business logic.
11
- * Use Cases (Application Logic) – ShoppingCartService manages
12
- * operations like adding items and checkout.
13
- * Interfaces & Adapters – Repositories (CartRepository, OrderRepository)
14
- * abstract data handling,
15
- * while controllers (CartController, OrderController) manage interactions.
9
+ * <p>In the example there are Entities (Core Models) – Product, Cart, Order handle business logic.
10
+ * Use Cases (Application Logic) – ShoppingCartService manages operations like adding items and
11
+ * checkout. Interfaces & Adapters – Repositories (CartRepository, OrderRepository) abstract data
12
+ * handling, while controllers (CartController, OrderController) manage interactions.
16
13
*/
17
14
@ Slf4j
18
15
public final class App {
@@ -31,10 +28,8 @@ public static void main(final String[] args) {
31
28
CartRepository cartRepository = new InMemoryCartRepository ();
32
29
OrderRepository orderRepository = new InMemoryOrderRepository ();
33
30
34
- ShoppingCartService
35
- shoppingCartUseCase =
36
- new ShoppingCartService (
37
- productRepository , cartRepository , orderRepository );
31
+ ShoppingCartService shoppingCartUseCase =
32
+ new ShoppingCartService (productRepository , cartRepository , orderRepository );
38
33
39
34
CartController cartController = new CartController (shoppingCartUseCase );
40
35
OrderController orderController = new OrderController (shoppingCartUseCase );
@@ -46,7 +41,7 @@ public static void main(final String[] args) {
46
41
Order order = orderController .checkout (userId );
47
42
LOGGER .info ("Total: ${}" + cartController .calculateTotal (userId ));
48
43
49
- LOGGER .info ("Order placed! Order ID: {}, Total: ${}" ,
50
- order .getOrderId (), order .getTotalPrice ());
44
+ LOGGER .info (
45
+ "Order placed! Order ID: {}, Total: ${}" , order .getOrderId (), order .getTotalPrice ());
51
46
}
52
47
}
0 commit comments