J2EE pattern • Business
J2EEBusinessJava example
Business Delegate solves a specific structural problem in the design.
Hide remote service or business-tier lookup details from clients.
Pattern overview
J2EE pattern
Hide remote service or business-tier lookup details from clients.
Intent
Reduce coupling between presentation clients and business-service implementation details.
Problem
UI or web tiers should not know how to locate, call, or handle remote business services.
Solution
Introduce a delegate that wraps service access and exception translation.
Fit and tradeoffs
FamilyJ2EE
CategoryBusiness
Best used when
- When the caller should stay insulated from remote or business-tier complexity.
Tradeoffs
- Adds one more layer that must stay thin and purposeful.
Java example
This example is intentionally compact so the pattern shape stays easy to see.
public final class OrderDelegate {
private final OrderService orderService;
public OrderDelegate(OrderService orderService) {
this.orderService = orderService;
}
public OrderSummary loadSummary(String id) {
return orderService.findSummary(id);
}
}