CQRS as nominalism by Eduardo Bellani
A theme that I think is important to understand a lot of modernity and the IT sector in particular, is nominalism.1
So, what is Nominalism, and why does it matter? I’ll start with a concrete case and work my way to the abstract definition. The case in point is a somewhat popular architecture tactic, CQRS.
What is CQRS? Here is an authoritative word on it(Young 2010):
Command and Query Responsibility Segregation (CQRS) originated with Bertrand Meyer’s Command and Query Separation Principle
…
It states 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. More formally, methods should return a value only if they are referentially transparent and hence possess no side effects.
…
Basically it boils down to. If you have a return value you cannot mutate state. If you mutate state your return type must be void.
…
in CQRS objects are split into two objects, one containing the Commands one containing the Queries.
CQRS is basically then an extension on CQS, but played on objects instead of methods. It leverages the notions of immutable and mutable objects, a feature it shares with a more encompassing approach, DDD(Evans 2014). Here is a mapping of the terminology. 2
CQRS | DDD | Traditional | Interpretation |
---|---|---|---|
Domain model | Entity | Variable | A symbol that represents a value of a given type. Can represent different values on different calls |
Read model | Value Object | Value | An element of a set |
Command | Aggregate command | assignment operator | Change the value of a variable |
Query | Side effect free function | function call | Derive values from values |
As this table shows, we have new names for old things, and people think that because of that they are different things. My point is that this is because of a nominalist position of the people on the CQRS community, even if they are unaware of that. Why? Here’s what nominalism is:
Nominalism … denies the existence of abstract and universal concepts, and refuses to admit that the intellect has the power of engendering them. What are called general ideas are only names, mere verbal designations, serving as labels for a collection of things or a series of particular events. (De Wulf 1911)
When you don’t believe that general ideas exist as such, you have a strong (inevitable?) tendency to mistake names for things, like the CQRS community did here.
PS: Any implementation patterns that apply to CQRS would also apply to the tradional concepts, since my point here is to show that they are the same thing.