Day 15 — Adam Bien's BCE Architecture Pattern¶
Daily Time Investment: 2.5 hours | Week: 3 | Phase: 3
Daily Schedule¶
| Segment | Duration | Activity |
|---|---|---|
| Core Theory | 45 min | Boundary (JAX-RS facade), Control (business logic), Entity (JPA as DTO), anti-patterns eliminated |
| Book Reading | 30 min | EE Patterns Ch3 — Rethinking the Business Tier |
| Hands-On Lab | 75 min | Refactor monolithic service into strict BCE package structure; verify zero DTO mappings and zero redundant interfaces |
Files in This Day¶
-
EE Patterns Ch3 — BCE Pattern & Rethinking the Business Tier
Adam Bien's BCE pattern: Service Façade (Boundary), Service (Control), Persistent Domain Object (Entity as DTO). Package-by-feature, eliminating interface-per-class, eliminating DTO explosion, Gateway pattern, Fluid Logic, retired J2EE patterns.
-
Lab Guide — BCE Architecture Refactoring
Build
NodeResource(Boundary),HealthCalculator+NodeLifecycleController(Controls),ClusterNode+NodeSummaryrecord (Entities). Direct entity serialization via JSON-B. JPQL constructor expressions for lightweight projections.
Prerequisites to Continue¶
New concepts not seen in Phase 1 or Phase 2
- Package-by-Feature vs Package-by-Layer — traditional architectures use horizontal layers (
service/,dao/,dto/); BCE uses vertical feature packages (node/boundary/,node/control/,node/entity/) — all code for one domain feature lives together - Entity as DTO (Entity as Transfer Object) — instead of writing a parallel
NodeDTOfor everyClusterNodeentity, the JPA@Entityis serialized directly by JSON-B;@JsonbTransientprotects internal state (e.g.,passwordHash) from serialization - No-Interface View (CDI 4.0) — CDI proxies concrete
@ApplicationScopedor@Statelessbeans directly without requiring an interface; the interface-per-class pattern (INodeService+NodeServiceImpl) is pure overhead - Anemic Domain Model Anti-Pattern — entities with only getters/setters and no behavior; BCE fixes this by placing domain methods (e.g.,
canTransitionTo(NodeStatus),calculateHealthScore()) directly on the entity class @JsonbTransient— Jakarta JSON Binding annotation that excludes a field from serialization output; equivalent to@JsonIgnorein JacksonNodeSummary record— Java 21recordused as a lightweight read-only DTO created via JPQLSELECT NEWconstructor expressions; immutable, no entity lifecycle overhead