Performance: Event-driven architecture pattern
MEDIUM IMPACT
This pattern affects how quickly the application responds to user actions and external events, impacting interaction responsiveness and backend processing speed.
@Async
@EventListener
public void handleOrderCreated(OrderCreatedEvent event) {
paymentService.charge(event.getOrder());
inventoryService.updateStock(event.getOrder());
notificationService.sendConfirmation(event.getOrder());
}
public void createOrder(Order order) {
applicationEventPublisher.publishEvent(new OrderCreatedEvent(this, order));
}public void processOrder(Order order) {
// Direct synchronous processing
paymentService.charge(order);
inventoryService.updateStock(order);
notificationService.sendConfirmation(order);
}| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Synchronous service calls | N/A | N/A | N/A | [X] Bad |
| Event-driven asynchronous handling | N/A | N/A | N/A | [OK] Good |