Skip to content

Commit f6e0951

Browse files
authored
Merge pull request #137 from Nantero1/add-anchor-cqrs
feat: Add CQRS semantic anchor
2 parents c81dacd + 6c6805d commit f6e0951

3 files changed

Lines changed: 55 additions & 0 deletions

File tree

docs/all-anchors.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ include::anchors/user-story-mapping.adoc[leveloffset=+2]
105105

106106
include::anchors/adr-according-to-nygard.adoc[leveloffset=+2]
107107

108+
include::anchors/cqrs.adoc[leveloffset=+2]
109+
108110
include::anchors/arc42.adoc[leveloffset=+2]
109111

110112
include::anchors/atam.adoc[leveloffset=+2]

docs/anchors/cqrs.adoc

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
= CQRS (Command Query Responsibility Segregation)
2+
:categories: software-architecture
3+
:roles: software-architect, software-developer
4+
:proponents: Greg Young, Bertrand Meyer, Udi Dahan
5+
:related: domain-driven-design, hexagonal-architecture, fowler-patterns
6+
:tags: cqrs, cqs, architecture, commands, queries, read-write-separation
7+
8+
[%collapsible]
9+
====
10+
Also known as:: CQS at architectural scale
11+
12+
[discrete]
13+
== *Core Concepts*:
14+
15+
Command Query Separation (CQS):: Bertrand Meyer's principle — methods either change state (commands) or return data (queries), never both
16+
17+
Commands:: Write operations that change state and return void; represent intent as immutable command objects
18+
19+
Queries:: Read operations that return data with no side effects; safe to retry and cache
20+
21+
Separate read/write models:: Independent data models optimized for their respective purpose
22+
23+
Eventual consistency:: Read model may lag behind write model; acceptable trade-off for scalability
24+
25+
Event-based synchronization:: Domain events propagate changes from write side to read side projections
26+
27+
Independent scalability:: Read and write sides can be scaled, deployed, and optimized independently
28+
29+
Event sourcing optional:: CQRS does not require event sourcing; the patterns are complementary but independent
30+
31+
32+
Key Proponents:: Greg Young (coined CQRS), Bertrand Meyer (CQS origin, "Object-Oriented Software Construction", 1988), Udi Dahan
33+
34+
[discrete]
35+
== *When to Use*:
36+
37+
* Systems with asymmetric read/write workloads
38+
* Complex domains where read and write models diverge significantly
39+
* Event-sourced systems requiring materialized views
40+
* High-performance systems needing independent scaling of reads and writes
41+
* Collaborative domains with task-based UIs
42+
43+
[discrete]
44+
== *Related Anchors*:
45+
46+
* <<domain-driven-design,Domain-Driven Design>> - Often combined with CQRS for complex domains
47+
* <<hexagonal-architecture,Hexagonal Architecture>> - Ports and adapters complement CQRS separation
48+
* <<fowler-patterns,Fowler Patterns>> - CQRS builds on enterprise application patterns
49+
====

skill/semantic-anchor-translator/references/catalog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ Source: https://github.com/LLM-Coding/Semantic-Anchors
5353
- **Proponents:** Gernot Starke, Peter Hruschka
5454
- **Core:** 12-section template for documenting software architecture
5555

56+
### CQRS (Command Query Responsibility Segregation)
57+
- **Proponents:** Greg Young, Bertrand Meyer, Udi Dahan
58+
- **Core:** Separate read/write models, commands return void, queries return data with no side effects, independent scalability
59+
5660
### C4-Diagrams
5761
- **Core:** Context, Container, Component, Code — 4 zoom levels
5862

0 commit comments

Comments
 (0)