TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

DDD, Event Sourcing, and CQRS Tutorial

39 pointsby lisa_hendersonover 9 years ago

4 comments

buffoonover 9 years ago
Some quick points on DDD&#x2F;CQRS&#x2F;Event sourcing from my perspective. I&#x27;ve been involved in a project and have a number of concerns:<p>Firstly, the main drivers of this i.e. Greg Young&#x2F;Udi Dahan&#x2F;Particular are trying to sell a product and consultancy. While there is nothing wrong with this, there is a significant cost and the motivation to use this architecture is marketing driven rather than logical gains. Make sure it is appropriate for your organisation. 95% of organisations it probably isn&#x27;t. It wasn&#x27;t for ours but overzealous architecture proponents bought the marketing.<p>The cognitive load is immense compared to a smaller system architecture. Every change results in masses of friction, cost and time. Your agility will be destroyed pretty quickly. Also due to the cross-cutting concerns, there is no escape from it other than to port everything away.<p>The products to support it are generally immature, low quality and opinionated to the point that it&#x27;s impossible to integrate cleanly on anything but a greenfield. Expect friction.<p>There are better gains to be had from changing your architecture to a purely service model (I hate the term, but microservices) and skip the whole concept.<p>However if there&#x27;s one thing I have learned that Command-Query Separation is a good model for isolation. The Event Sourcing bit, not so much.
评论 #10190210 未加载
hartrorover 9 years ago
I really like Greg Young&#x27;s talks on CQRS and Event Sourcing.<p>* <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=JHGkaShoyNs" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=JHGkaShoyNs</a><p>* <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=KXqrBySgX-s" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=KXqrBySgX-s</a>
victorNicolletover 9 years ago
I am a big user of both CQRS and Event Sourcing, but not in the very narrow sense implied by DDD&#x2F;CQRS&#x2F;ES advocates. In particular, there are two main tenets that I feel are not sufficiently justified.<p>One is the idea that commands are write-only (they are not allowed to return information). The reason for this restriction is fairly unclear, and there are several pieces of information that I believe can be legitimately returned:<p>- Has the command finished executing?<p>- Was it successful? If not, what was the exception thrown?<p>- If the command created something, what is that thing&#x27;s identifier?<p>- For distributed systems, what is a vector clock after the command&#x27;s execution?<p>Another idea is aggregates, especially the fact that each event is bound to a single aggregate and that two aggregates process their associated events independently. I can see how this can be useful, in a NoSQL-ish kind of way: by sacrificing the ability to enforce invariants across multiple aggregates, it becomes trivial to distribute event streams, to quickly compute the state of a single aggregate among millions, and to write to several aggregates in parallel without a global lock.<p>Still, sacrificing those invariants is costly. Many domains will have constraints on uniqueness (e.g. each e-mail address may belong to only one user) or relationship arity (e.g. each student may have at most one internship, each internship may have at most one student), and from my experience, expressing those constraints in an aggregate-based system usually ends up in:<p>- creating a &quot;lock&quot; aggregate with &quot;Locked&quot; and &quot;Unlocked&quot; events, or<p>- ignoring constraints and providing an user interface to manually resolve violations.<p>I would rather express simple constraints with simple code and have to work hard for optimizations later, than to have to write complex code just to solve an unconfirmed performance issue.
socceroosover 9 years ago
A nice resource for those exploring a completely event sourced, domain driven, responsibility segregated application.<p>I really do loath the acronyms.
评论 #10189433 未加载