Chapter 3 — Roles and Business Identity¶
© 2026 S++ project contributors. All rights reserved. Book copyright.
An entity is a concrete business subject; a role is the capacity in which it participates. Product may have a catalog name and specifications, while Goods adds selling status and price. These facts are related but need not have the same owner.
Facts, Qualification and Identity¶
A person can play Buyer and Merchant, but membership tier belongs to Buyer while store identity belongs to Merchant. Creating the person does not automatically establish authorization to trade. Eligibility and role-specific facts must be established for the participation in question.
Conversely, a person or a company may play Buyer when each satisfies the Buyer's contract. Role polymorphism is treated in Chapter 8; here the issue is how the participating identity is modeled.
Relationships Can Be Roles¶
A cart line depends on both a Buyer and Goods. Its quantity is a fact of their relationship, not a permanent property of either player alone. A composed role can express those participants together:
Role CartLine {
Buyer;
Goods;
int quantity;
}
A role can itself play another role. Goods used in an OrderLine may provide current product facts, while OrderLine separately retains agreed quantity, unit price and description. A later price or name change must not rewrite the historical agreement.
Composition Is Not Flattening¶
A participant member declares intrinsic role composition. When a take relationship supplies players, it joins them with those required members; distinct take alternatives are not replacements for the role's intrinsic structure. Intermediate role identities remain meaningful. Chapter 14 specifies these rules.
A service names each participant once by its role. If two cash drawers appear in a transfer, source and destination are distinct participating roles even if they have the same underlying entity type; Chapter 15 shows how rules refer to them.
Extensible roles also have stable storage identities. APP maps player associations without replacing a role's own primary key; inline versus separate-table storage is a technical choice, not a change in business uniqueness.
Roles therefore distinguish what an entity is, how it participates and which facts belong to that participation.
Part Contents · Full Book Contents · Previous Chapter · Next Chapter