Understand the Smart Domain Architecture Pattern
mainThe project implements the Smart Domain architecture pattern as a way to realize Domain-Driven Design (DDD). The core idea is to model relationships in the domain model as Association Objects (关联对象) rather than simple properties.
Key principles include:
- Modeling Associations as Objects: Instead of direct references, relationships are represented by interfaces that act as association objects.
- Exposing API over Model: The domain model is mapped to a RESTful API where the URI structure mirrors the association relationships (e.g.,
/customers/{cid}/accounts/{aid}). - Separating Business Aggregates from Lifecycles: A critical distinction is made between business aggregation (how things are grouped conceptually) and technical lifecycles (how things are loaded from storage). You can represent a business aggregate via a URI even if the technical implementation uses a 'reference' lifecycle to avoid loading massive amounts of data into memory.