Messages
Messages are a foundational concept in RIDDL because a RIDDL model implies an implementation that is a message-driven system per the Reactive Manifesto. Messages in RIDDL are a special case of an aggregate type and the lingua franca of many RIDDL definitions. They define the API for all the processors:
and
repositorysThat is, these are the fundamental building blocks of a message-driven system
RIDDL follows Bertrand Meyer’s notion of command/query separation which states, in the context of object-oriented programming in Eiffel that:
every method should either be a command that performs an action, or a query that returns data to the caller, but not both. In other words, asking a question should not change the answer.1
Consequently, RIDDL adheres to this principal and employs the notion in message definitions since RIDDL is message-oriented not object-oriented. However, RIDDL also includes message types for the responses from commands and queries, events and results, respectively. The following subsections provide definitions of these four things
A directive to perform an action, likely resulting in a change to some information.
A recordable fact resulting from a change to some information.
A request for information from something
A response to a query containing the information sought.
The various characteristics of the four kinds of messages are shown in the table below.
| Kind | Request? | Response? | Cancellable? | Relationship |
|---|---|---|---|---|
| Command | Yes | No | Yes | Independent |
| Event | Maybe | Yes | No | Consequent Of Command |
| Query | Yes | No | Yes | Independent |
| Result | No | Yes | No | Consequent Of Query |
The truth table above helps you understand the relationship between the kind of message and how it is handled by a model component. The sections below get even more specific.
| Kind | In Regard To Handling By Adaptor |
|---|---|
| Command | Intent To Translate For Context |
| Event | Intent To Translate For Context |
| Query | Intent to Translate For Context |
| Result | Intent to Translate For Context |
| Kind | In Regard To Handling By Application |
|---|---|
| Command | Data given from user to application |
| Event | Not Applicable |
| Query | Not Applicable |
| Result | Data provided to user from application |
| Kind | In Regard To Handling By Context |
|---|---|
| Command | Intent To Take Some Stateless Action |
| Event | Notification That a Command Completed |
| Query | Intent to Read From The Context |
| Result | Result Of Reading From Context |
| Kind | In Regard To Handling By Entity |
|---|---|
| Command | Intent To Modify Entity State |
| Event | Entity State Was Changed |
| Query | Intent To Read Entity state |
| Result | Consequent Of Query |
| Kind | In Regard To Handling By Processor |
|---|---|
| Command | Intent To Update Projection State |
| Event | The Projection’s State Was Modified |
| Query | Intent to Read Projection State |
| Result | Result Of Reading Projection State |
| Kind | In Regard To Handling By Projection |
|---|---|
| Command | Intent To Update Projection State |
| Event | The Projection’s State Was Modified |
| Query | Intent to Read Projection State |
| Result | Result Of Reading Projection State |
Meyer, Bertrand. “Eiffel: a language for software engineering”. p. 22 ↩︎