S++Core systems, human-reviewable
ENGLISH EDITION · OCTOBER 15, 2026
ContentsComplete book

Chapter 15 — Four Categories of Atomic Service

© 2026 S++ project contributors. All rights reserved. Book copyright.

Ordinary business atomic services are query, check, calculate and update. They retrieve facts, judge conditions, form candidate results and apply changes. Scenarios combine them into complete activities.

Queries Complete Facts

Ordinary query is built-in. Scenarios call findBuyer and similar services directly; APP/PHY retrieve facts and complete input participants without redeclaring standard queries. There is no business return value such as buyer = findBuyer(). Identity confirmation is execution state, not inferred from nonempty fields. Completion need not load the whole role chain; property analysis and caching can optimize it as described in Part II, Chapter 11.

A service signature lists participant types only, as in (Buyer, Goods, StockLine[]). Its body refers to each participant by a short name: the type name in lower camel case, so buyer, goods and, for an array, stockLines. A type can declare its own, for example Entity ExternalLoss short loss, losses; the second name is the array form. Writing an explicit parameter name is a compile error, as is a short name used twice in one signature. A type appears once per shape, so a selector and its result collection can share a type, but two scalar records of one entity need two roles. Omitted call arguments still require unique matching by complete type and collection dimension; ambiguity requires explicit selection.

When other participants supply the lookup values, the read lists them with by. The target's key fields are taken from the listed participants through their take mappings, or from a field set to a constant:

Role Book { String code; int edition; }
Role Selection { String requestedCode; }
take Selection as Book { String code = requestedCode; }

readonly Scenario serial readSelectedBook(Book, Selection) {
    findBook by selection, book.edition = 3;
}

With APP declaring Book.code and Book.edition as the primary key, the code comes from selection.requestedCode and the edition from the constant. Each key field needs exactly one source, and the compiler checks the take relation and the field types.

Validation Checks Eligibility

check reads facts and uses require for requirements without changing participants. A failing check ends its enclosing bare block, at any depth of if/else nesting. A bare block is an explicit serial { } or parallel { }, a transaction { } or a failure handler; the bodies of if/else and of a guarded check are transparent. When that block is the transaction itself, the failure rolls the whole transaction back. To leave only part of the logic, wrap it in an extra serial { }: a failing check there exits only that block and the transaction continues. Outside a transaction a failing check only ends its block. checkXXX,breakTransaction rolls back the whole transaction from any depth.

Visible checks clarify admission. Actual quantum bounds must be enforced at settlement, not substituted by earlier balance reads.

Calculations Prepare Results

calculate changes candidate facts through formulas. It may call pure calculations, not query, check, update or scenarios to hide side effects.

atomic calculate priceLine(OrderLine) {
    orderLine.amount = roundHalfUp(
        orderLine.unitPrice * orderLine.quantity, 2);
}

This definition is from pricing source, with line wrapping for presentation.

Updates Apply Changes

Ordinary update is also built-in. After preparing complete facts, scenarios call standard insert, update or delete services suffixed by participant type. Current participants are passed; the framework retains technical baselines without a business before snapshot. Business calculations and checks stay outside the built-in update. Quantum updates describe special-property deltas and settlement requirements.

Preparation and checks may precede settlement where dependencies permit; earlier checks do not replace protected execution.


Part Contents · Full Book Contents · Previous Chapter · Next Chapter