Skip to content

Instantly share code, notes, and snippets.

@trikitrok
Last active June 18, 2025 17:37
Show Gist options
  • Save trikitrok/58d85160a78b8fb8b365155c448bccec to your computer and use it in GitHub Desktop.
Save trikitrok/58d85160a78b8fb8b365155c448bccec to your computer and use it in GitHub Desktop.
without notifications: direct coupling to may collaborators
public class ProcessOrder {
private EmailService emailService;
private InventoryService inventoryService;
private LogisticsService logisticsService;
private AccountingService accountingService;
// ... code omitted for brevity
public void execute() {
// business logic to process an order (code omitted for brevity)
// ...
// secondary behaviours associated to an order that has been processed.
emailService.sendOrderConfirmation(orderDto);
inventoryService.updateStock(orderDto);
logisticsService.scheduleDelivery(orderDto);
accountingService.recordTransaction(orderDto);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment