Rui Carvalho
Software craftsman, experienced in Microsoft technologies
@rhwy
alt.net fr talks #17.01
(no silverbullet, always ask why!)
Text
https://github.com/tpierrain/CQRS
Too complex for our real crudy day to day business line applications?
1/
(even if eventsourcing can't help a lot!)
2/ Should I use and master DDD to use it?
DDD is a toolbox that you should use in coherence, but also some parts only
What is it then?
Greg Young
(Architecture pattern)
https://cqrs.files.wordpress.com/2010/11/cqrs_documents.pdf
ok, and for my code?
Bertrand Meyer
(object oriented software)
https://en.wikipedia.org/wiki/Command%E2%80%93query_separation
https://www.amazon.com/gp/product/0136291554
At the method level,
...works at Object level too!
Let's take a Repository
IProductRepository
GetAll()
New(product)
Remove(id)
Update(id,values)
Sounds good, but what happen under load?
In production?
IProductRepository
GetAll()
Get(id)
New(product)
Remove(id)
Update(id,values)
1 x New
10 x Update
1000000 x Get()
Split it into 2 dedicated interfaces (ISP remember?)
IProductRepository
GetAll()
Get(id)
New(product)
Remove(id)
Update(id,values)
IProductQueries
GetAll()
Get(id)
New(product)
Remove(id)
Update(id,values)
IProductCommands
Then implementations can have different life cycles!
ProductQueries
GetAll()
Get(id)
New(product)
Remove(id)
Update(id,values)
ProductCommands
SQL DB
REDIS CACHE
TABLES FOR WRITES
AND MATERIALIZED VIEWS FOR READS!
ProductsTable
ProductsCatalog View
Indexes
Insert into
ProductsTable
Select from
ProductsCatalogView
By Rui Carvalho