Domain Entity (DE)

ARCHITECTURAL Role

This pattern is used within the Shareable architectural layer. By “shareable”, we mean that the same instance is available for use by the Inbound/Outbound, Business, and Integration layers. 

BEHAVIOR DEFINED

A PED Domain Entity (DE) represents a physical entity with a unique identity. That is, they are the nouns when designing an object model. These are the objects used for 

Scott Ambler offered this elaboration at Ford Motor Company in August of 2011:

“Using a natural key rather than a generated key is a bad, bad, bad, bad, bad practice.”

Agreeing whether a DE should contain encapsulated behavior (beyond accessor methods) is a significant design concern explicitly settled by an application development team when adopting their own Pattern Palette.

Structural Characteristics

Characteristic

Recommended

Note

 Extend Base Class Y  1.
 No-arg Constructor Optional  
 CDI Scoping None  
 Instance State Y  
 Static Public Methods (enum) N  
 Fluent Methods Y  2.
 Delegate to Helper N  
 Worker-thread Safe N 3.
  1. For example, base classes might include a BaseAuditDE and BaseUuidDE.
  2. Setters may be fluent.
  3. Avoid passing the same DE instance to multiple worker threads.
Source Example