Apparently we are in a cult..

531 views
Skip to first unread message

Adam Dymitruk

unread,
Oct 29, 2010, 1:34:24 AM10/29/10
to ddd...@googlegroups.com
... we have blindly accepted CQRS on faith purely.

This is the way a normal person should see CQRS according to Jak:

"CQRS - The Cult of Shiny Things
CQRS has become another casualty of the buzzword culture and the cult
of 'shiny things'

What started as a collection of some reasonably good principles has
now turned into an almost religious mantra for some, with more and
more outrageous claims, and almost no basis in fact or experience.

Scalability
Claims like "almost infinitely scalable systems" associated to CQRS
are ludicrous, especially as none of the currently "near infinitely
scalable systems" use CQRS or have probably even heard of it. The
largest systems on the planet have no need of CQRS, they use many
tricks and techniques that have been associated with CQRS - but they
don't use it, nor are they ever likely to use it, because when you
have really large systems, things like CQRS become totally irrelevant.

The scaling benefits of CQRS come from understanding eventual
consistency and messaging - concepts that were around long before
CQRS, and that will be around long after it too.

Task Based UIs
Well, yes CQRS may require a task based UI, but task based UIs were
again around long before CQRS, and will again outlast it. This is just
a different way of thinking about how people interact with computers -
this is a UX issue, not a technical one.

In fact, if anything, CQRS can be a major cause of issues here - when
you really have a CRUD style system, CQRS is going to cause you all
sorts of issues you will need to resolve. And much as I dislike CRUD
based UIs, the reality is we have abused users to work this way in
many cases - so sometimes that is just how we have to make our next UI
work.

Side Effect Free
Another aspect of CQS (and by extrapolation CQRS) is that functions
employing CQS are side effect free - you don't accidentally introduce
subtle bugs by writing and reading in one operation.

And while this is nice in theory, the scale of system where this
preventative measure would have benefit is the one where this problem
is just as easily solved by many other simpler means, like just
writing smart code. Larger systems have so many points in them where
read and write are already being mixed, CQRS here just lends an
illusion of safety.

Denormalised Read Models
A valuable benefit of CQRS is the concept that the views have specific
read models that are denormalised from the (presumably) complex domain
model.

This has a number of benefits, though these are largely boiled down to
improved efficiency of querying (and action that tends to happen
frequently). These models can also be extrapolated out to provide
reporting and MI models too.

But again, we have been doing this for many years already, and usually
to account for overloaded database servers that we don't wish to query
against, particularly with MI.

And querying these days, even with horribly complex joins on highly
complex models is becoming faster and faster. Push querying to a slave
server, and you gain all the benefits of a rich model, and fast
queries. And for even more speed you can look to NoSQL solutions -
which are effectively based on the principle that you denormalised
your data anyway.

Performance Considerations
Part of the theoretical benefit of CQRS is that your queries will be
faster as your denormalised datastores are updated at write time, so
you don't have to do horrible joins on queries (which in theory on
most systems happen far more frequently than writes)

These days, the performance of relational databases and especially
NoSQL databases is advancing rapidly. The new breed of databases takes
things like sharding and replication very seriously, and as first
class features, not afterthoughts like the databases of old did.

Replication in MySQL takes roughly 0.0002 of a second (see
http://nr-content.s3.amazonaws.com/railslab/videos/17-ScalingRails-Scaling-Your-Database-Part-1.mp4
at 6 minutes in) - compare that with how long a message based approach
like CQRS will take to push that to your secondary datastores and you
are talking orders of magnitude faster for the dumb replication
approach. Apparently it operates at this speed for up to 10 slave
databases before degrading.

Now, think about this bit, the 37 Signal systems (a huge system)
operates on a single MySQL instance running with 105Gb of memory
caching. And 37 Signal could be considered the archetype of an Active
Record approach, after all it is the reason Ruby on Rails exists. Are
you writing a system that big?

Maybe you are so let's examine a larger system - Wordnik stores over
12 billion documents, 3Tb of data per node, 500k requests per hour and
4 times that at peak load, and yet their fetch time is around 60ms.
(http://blog.wordnik.com/12-months-with-mongodb)

Let's not even begin to discuss Twitter, Ebay, Facebook or other
similar "mega systems" - they still respond in milliseconds with tens
or hundreds of millions of users - think that's down to CQRS?

Dealing with Complexity
Yep - CQRS deals with complexity to one degree - it forces you to
explicitly think about what each call is doing - "Is this writing data
or reading data?" - and that thought process is a good thing.

But it introduces another layer of complexity that is more subtle and
harder to deal with - the replication to secondary datastores is
complex in itself - it effectively needs to do that horrible join you
are trying to avoid in your queries so that it can update your
denormalised tables. That in itself isn't simple.

But it also needs to be able to maintain those secondary datastores
if, for example they are corrupted and need recreating or if they miss
some messages. In normal replication this is trivial, drop the slave,
add a new slave - wait a short while - someone already wrote all that
for you on a database system - you are going to need to write it all
yourself with CQRS.

So Why Have I Implemented CQRS Before?
Well, at the time I first implemented CQRS I had two reasons for doing
so - and oddly neither had to do with any of the aforementioned
technical aspects. In fact, one was a technical problem and one was a
people problem.

Firstly this was nearly two years back, and the system that we were
writing a layer over was a very old and crumbling legacy database
system. It had no real normalised schema, and was open to abuse from
just about every development team in the organisation without warning
to others - it was also horribly prone to outages.

One project had just "failed" (though I'm sure some would say it was
just a lesser success), primarily due to trying to put a domain model
on top of the legacy database.

So, the problem we had was to create a disconnected system that could
operate independently of the legacy system, but also use the legacy
system as it's true authority for the information it used. Because of
the horrible complexity in the legacy system, using CQRS allowed us to
write what were frankly quite horrible SQL statements for reading data
from legacy, while using a pseudo-document database for the daily
operations. We then used horrible SQL statements to replicate this
data back into legacy.

Of course, what we were really writing was a standard message based
architecture, but the term CQRS encompassed that quite nicely.

We could have approached this without the CQRS badge - but it served
as a useful political tool - a number of the existing team had heard
of it and were quite enthusiastic, and management would be confounded
enough by it to not get in the way too much. It also broke the mental
model the development teams had with "put an ORM over the database".

So the secondary benefit of CQRS here was a people problem - it was a
new buzzword - it got new enthusiasm from a team that was demotivated
from the previous project - and more than anything - that motivation
was going to be the key to the success or failure of the new project.

So Why Have I Presented On It Before?
Well two reasons really, the first being that I have always tried to
dispel the mythology around CQRS and to explain the real benefits of a
flexible and scalable architecture - it just so happens that people
want the buzzword explaining - you have to admit it's a pretty vague
and fuzzy term with a myriad of definitions and explanations.

The secondary reason being, as my last presentation at DDD Sydney
explained - my objective was to make you think. There's a lot of good
things hiding under the CQRS banner, and I really would like people to
think about better ways of writing software.

Conclusion
In the few years since CQRS was "invented" it has got a bit of a cult
buzzword status. It is talked about as though it fixes a multitude of
problems.

But in that time, NoSQL has really taken off. RBDMS' have got far more
powerful. And memory and processing power has increased significantly.
Database caching is exceptionally impressive. REST gives us proxy
caching for near enough free. Memcached and Velocity make light of
massive data loads. We even have the nefarious "cloud" now, where
processing power and memory is cheaper than the effort involved in
maintain complex architectures.

Scaling systems is now a pretty commonplace business problem for most
of the startups taking off -and they don't need CQRS - there is a
very good chance you don't either. We are past that point in time
where we had to prematurely optimise things like database queries.

If it's about thinking differently, then I can tell you all you need
to know about CQRS in a simple paragraph:

Learn to think of systems as being inconsistent at all times, no
matter what illusion they present of 'real time'. Learn to embrace
messaging, REST, caching, replication, sharding, and a hundred other
techniques to solve these problems. Embrace user centric task based
UIs, embrace strong UX, embrace strong domain driven design, embrace
business led functionality and delivering systems that match real
requirements. Embrace thinking differently.

CQRS is no silver bullet, in fact it has almost now become a solution
to a problem that doesn't exist any more. If you can give me a problem
that CQRS claims to solve, I'm fairly sure I can solve it more easily
than I could have done 2 years ago when I started using CQRS. I'm sure
I'll still use a lot of the things that CQRS encapsulates, because
they are after all very good principles - I'm just pretty much over
playing buzzword bingo!"

is what Jak said.

--
Adam

http://adventuresinagile.blogspot.com/
http://twitter.com/adymitruk/
http://www.agilevancouver.net/
http://altnetvan.grou.ps/

João Bragança

unread,
Nov 1, 2010, 7:05:53 PM11/1/10
to DDD/CQRS
Cool! Does that come with a cape...?
> Replication in MySQL takes roughly 0.0002 of a second (seehttp://nr-content.s3.amazonaws.com/railslab/videos/17-ScalingRails-Sc...

Adam Dymitruk

unread,
Nov 1, 2010, 8:33:04 PM11/1/10
to ddd...@googlegroups.com

Michael Brown

unread,
Nov 3, 2010, 8:15:50 AM11/3/10
to ddd...@googlegroups.com
So what he's saying is that DDD and CQRS/Event Sourcing do little more than
give a formal name/methodology to practices that have been accepted in the
industry for years. MISSION ACCOMPLISHED.

Rinat Abdullin

unread,
Nov 3, 2010, 8:27:07 AM11/3/10
to ddd...@googlegroups.com
Heh, reminds me of a recent xkcd comic on bots and spam protection.

On Wednesday, November 3, 2010, Michael Brown

--
Best regards,
*Rinat Abdullin*

Technology Leader at Lokad.com <http://www.lokad.com> | Writer at
Abdullin.com <http://abdullin.com> | Contacts <http://abdullin.com/contact/>

Nuno Lopes

unread,
Nov 3, 2010, 1:07:58 PM11/3/10
to ddd...@googlegroups.com
With all due respect I may disagree with Jak but to be honest people start behaving like a cult when they loose rationality.

> So what he's saying is that DDD and CQRS/Event Sourcing do little more than
> give a formal name/methodology to practices that have been accepted in the
> industry for years. MISSION ACCOMPLISHED.

No, is stating stuff about CQRS/ES. DDD he ack has something extremely practical.

>> formal name/methodology to practices that have been accepted in the
>> industry for years. MISSION ACCOMPLISHED.


No. He his stating that is CQRS neither is sufficient or a precondition of "infinite scalability". He is arguing for that matter other things beside CQRS are needed.

>> Side Effect Free
>> Another aspect of CQS (and by extrapolation CQRS) is that functions
>> employing CQS are side effect free - you don't accidentally introduce subtle
>> bugs by writing and reading in one operation.

Actually he writes about this is even more confused about it because he still thinks that a CQRS is a side effect free approach. But his confusion is not from someone that came from mars since once upon a time CQRS was called CQS and compared with the CQS principle.

The reality is that CQRS is anything but side effect free. Simply put, eventually consistent systems by definition ARE not side effect free. De-normalization is not a side effect free activity either.

That is WHY ES is important for CQRS in some cases. In order to cope with side effects in a systematic manner we need history!

It said that CQRS requires a Task based UI. True, but so do most enterprise architectures based on RPC.

Generically speaking what is saying is that he still does not understand specifically what kind of problems CQRS provides a solution to. Even though he as been using it. He only found out that it wasn't a solution for his problem when indeed he found the solution for his problem.

Now do you know if CQRS solves the problem you have? If you do maybe you can help him out.

Cheers,

Nuno


Neil Robbins

unread,
Nov 3, 2010, 1:11:32 PM11/3/10
to ddd...@googlegroups.com
On Wed, Nov 3, 2010 at 6:07 PM, Nuno Lopes <nbpl...@gmail.com> wrote:
With all due respect I may disagree with Jak but to be honest people start behaving like a cult when they loose rationality.

> So what he's saying is that DDD and CQRS/Event Sourcing do little more than
> give a formal name/methodology to practices that have been accepted in the
> industry for years. MISSION ACCOMPLISHED.

No, is stating stuff about CQRS/ES. DDD he ack has something extremely practical.

>> formal name/methodology to practices that have been accepted in the
>> industry for years. MISSION ACCOMPLISHED.


No. He his stating that is CQRS neither is sufficient or a precondition of "infinite scalability". He is arguing for that matter other things beside CQRS are needed.

>> Side Effect Free
>> Another aspect of CQS (and by extrapolation CQRS) is that functions
>> employing CQS are side effect free - you don't accidentally introduce subtle
>> bugs by writing and reading in one operation.

Actually he writes about this is even more confused about it because he still thinks that a CQRS is a side effect free approach. But his confusion is not from someone that came from mars since once upon a time CQRS was called CQS and compared with the CQS principle.

The reality is that CQRS is anything but side effect free. Simply put, eventually consistent systems by definition ARE not side effect free. De-normalization is not a side effect free activity either.


The read side of CQRS is side effect free though isn't it - at least in terms of Meyer's definition which limits it to Observable side effects.

Nuno Lopes

unread,
Nov 3, 2010, 2:08:46 PM11/3/10
to ddd...@googlegroups.com

> The read side of CQRS is side effect free though isn't it - at least in terms of Meyer's definition which limits it to Observable side effects.

IMHO that is an artifice of reasoning, another rhetoric point of no value. The context of Mayer's CQS is not about evaluating side effects of reads only or writes only, but articulating reads with writes in conjunction over facts on the same set. His articulate goes on the premiss order of execution is preserved by the underlying computing system.

The principle is so that when we execute two reads over the same set of facts, we still get the same set of facts provided that no command was executed in between.

CQRS does guarantee that at all. By separating the model for reads and model for writes you can very well execute a command over a set of facts, then another command, read over a set of facts on the Views, and then read again only to find out that facts have changed even though both reads where executed after the commands.

The fact is when we execute a command not only state changes but also an event is published! An event that needs to be processed by the read side in the ORDER they where executed otherwise not only you get eventually consistent view but also bananas with it. Now events can arrive out of ORDER in CQRS.

The fact that issue of ORDER events matter is the proof the CQRS is not side effect free for the scenarios usually considered of great value.

Temporal side effects are non existent if the order is maintained. Otherwise there are side effects that need to dealt with code. Some event with business process reengineering.

Hope it helps,

Nuno

Nuno Lopes

unread,
Nov 3, 2010, 2:15:56 PM11/3/10
to ddd...@googlegroups.com
I wrote:

"CQRS does guarantee that at all."

What I mean is: CQRS does NOT guarantee that at all.  

Cheers,

Nuno

Nuno Lopes

unread,
Nov 3, 2010, 2:21:41 PM11/3/10
to ddd...@googlegroups.com
I'm not saying with this, that the true value of using CQRS is harmed in anyway because of that.

Just clarifying a point that some of may take on board as a benefit, when it is not the case.

Nuno

Neil Robbins

unread,
Nov 3, 2010, 9:06:16 PM11/3/10
to ddd...@googlegroups.com

Disagree. Meyers driving idea behind CQS is to simplify the work for a developer of a client by establishing a convention around how members of an interface will behave based on the signature of any member.  The critical guarantee made by any query member is that by the client calling it there will ne no discernable impact on the observable state which a call to this member (or any other member belonging to that type)  renders.

Exactly this guarantee is made (or should be) in a CQRS system. It goes directly to the core of the separation, otherwise queries and commands are no longer distinct (so no meaningful responsibility segregation)!

That the impact of the command side may have an effect on the query side which causes changes over an indeterminate period of time is immaterial to a discussion as to the presence or absence of CQS in CQRS (which frankly seems absurd & contrived) since the command side is clearly solely responsible for any changes to observable state.

Neil Robbins

unread,
Nov 3, 2010, 9:20:26 PM11/3/10
to ddd...@googlegroups.com

Also, with CQRS:

Events need never be published;
Eventual consistency is not necessary;
Events, if published, may arrive out of order in CQRS, *may*, but this is still a logical part of command processing & there are trivial PoEAI which will ensure the application of updates to query sources in an appropriate order (not that the absence of this is significant when considering whether CQRS extends, but maintains, CQS)
If doing ES then typically the event being published is the only cause of a change in observable state, a change in the internal state of an aggregate is practically immaterial from a CQS POV.
Temporal side effects as you call them are still side effects originating from the processing of a command, so the effect of calling a query is still side-effect free.

On Nov 3, 2010 7:08 PM, "Nuno Lopes" <nbpl...@gmail.com> wrote:

> The read side of CQRS is side effect free though isn't it - at least in terms of Meyer's definiti...

Nuno Lopes

unread,
Nov 4, 2010, 6:41:32 AM11/4/10
to ddd...@googlegroups.com
Hi Neil,

Short answer:

For you to understand a principle such as CQS you need to understand the context of such principle. In this case, context is highly driven by Bertrand Meyer work on OOP. Have you read his work, book? If you did you will understand what I'm going to say.

Bertrand work around OOP shows that his concerns where in part driven by establishing the correctness and soundness of OO software. His work lead to the creation of DbC and other methods as well as a language.

Within this, his principles, methods and patterns are driven by these objectives.

If CQRS separation of commands and queries is in anyway related to establish program correctness then use views to make you unit test asserts. Please do, but I would not advise.

Can you imagine if we ran a set of tests there is no reason to fail but probably they can fail?

Long answer:

Meyers driving idea behind CQS is to simplify the work for a developer of a client by establishing a convention around how members of an interface will behave based on the signature of any member.  The critical guarantee made by any query member is that by the client calling it there will ne no discernable impact on the observable state which a call to this member (or any other member belonging to that type)  renders.

??????

Behind a principle, there are usually a set of observations. A core observation Meryer did, is that for one to make an assertion we need queries. If queries changed state, it would be possible that by making an assertion it we could change it. 

Why is this an important observation in Meyers work? 

Because if the mere act of making a Precondition changed the premisses over which state will be changed and by making and Post Condition changed again the state we can imagine how hard it would be to test such a system. Hence having stable contracts.

We could not make reliable contracts with it. As such pre conditions could not be dropped, neither could post conditions.

In CQRS I can make a Query against a View for a precondition over an AR. According to this observation the precondition is met so I send a Command. When the Command is processed if preconditions not checked again the precondition may no longer be met hence producing an unexpected result (side effect). So which model is correct, the read model or the write model? 

This is related to a recent question of Udi. "What would be the problem if our master records where in the views". If CQS principle was indeed applicable to the CQRS separation, the answer to such question would be trivial. No problem. Yet, that is not the case.

You see, CQRS is not the only system that separates command from queries. Just because you do so, it does not mean that you are applying the principle. MVC also does such separation (It calls INPUTS and OUTPUTS). He does not  claim that MVC is driven by establishing correctness. Core SQL operations such as INSERT, DELETE, UPDATE and QUERY also make such separation. Yet it only guarantee the absence of side-effects within a transaction (ACID).

There is a reason why Gregs Unit Tests in commands use Events for asserting precondition and post conditions and not queries on views. Precisely because such assertions would be unreliable if they used the read side, hence establishing correctness would be compromised.

Eventual consistency is not necessary;

True, yet applying CQRS explicitly on a solution where with no plans to use eventual consistency for scalability purposes is an exercise of waste (IMHO). That IMHO differentiates people that are only able to reason in a Cult from people able to reason across Cults. I think you are on the second group but still a bit confused.

Hope it helps,

Nuno

Simon Harris

unread,
Nov 4, 2010, 8:09:38 AM11/4/10
to ddd...@googlegroups.com, ddd...@googlegroups.com
Eventual consistency is not necessary;

True, yet applying CQRS explicitly on a solution where with no plans to use eventual consistency for scalability purposes is an exercise of waste (IMHO).

Hmmm i must beg to differ. I don't need eventual consistency but if i consider events as the protocol, it provides me with great opportunity to separate the construction of the UI from that of the core domain model.

Perhaps I'd rephrase it then as: if you have no plans to take make use of the separation of concerns then, ...

Nuno Lopes

unread,
Nov 4, 2010, 8:42:08 AM11/4/10
to ddd...@googlegroups.com
Hi Simon

> Hmmm i must beg to differ. I don't need eventual consistency but if i consider events as the protocol, it provides me with great opportunity to separate the construction of the UI from that of the core domain model.


True. But for that purpose you can also consider implementation around MVC and Presentation Model. In particular MVC the does not mandate the use of event to populate views yet a lot of solutions make use if them for this purpose (Real Time View updates).

Myself I find hard to make a distinction between CQRS and MVC if not in context. So I'm guilty of some ambiguity in my position regarding CQRS and eventual consistency. Although CQRS does not requite eventual consistent, most interesting technical discussions around CQRS to me are under this premiss.

Still to me MVC is CQRS. So such generic term I agree with you.

Cheers,

Nuno

Neil Robbins

unread,
Nov 4, 2010, 8:42:52 AM11/4/10
to ddd...@googlegroups.com
Ok, well I'll try & ignore barbed nonsense.

Let's start with you last assertion, because I think that this is key. Correct me if I'm wrong but as I understand it you are suggesting that CQRS without eventual consistency (at least planned for) is pointless.

Eventual consistency is something that is particularly painful to accept within a system. I think I remember Werner Vogels saying something like 'nobody wants to give up eventual consistency, but sometimes you have to' at the NoSQL EU conference. He, is of course, absolutely correct. One of the reasons why this is so is something I think that you are touching on, that doing so means we lose referential transparency - something which Meyer is very keen on. I would argue that the vast majority of systems do not need to introduce eventual consistency & that, as Casey argues, most of the benefits of this can be had through infrastructure & established technologies like caching. Avoiding this makes our lives as developers much simpler. Why, well as Meyer says:

"From the Command-Query Separation principle follows a style of design that yields simple and readable software, and tremendously helps reliability, reusability and extendibility." (handily I keep the pdf copy of his work on my laptop & my kindle as it is one of the few texts which I find myself returning too again & again)

I don't think that anyone would argue that eventual consistency leads to simple and readable software, nor help reliability (not the same thing as availability). It may help extendibility, but I think even that would be open to debate. Note I am not discussing EAI scenarios here (say updating the corporate CRM from a LOB system) where such qualities as referential transparency are less of a benefit. I am particularly considering the relationship between the query and command parts of a system.

So what benefits might I see in CQRS without eventual consistency? One of the key benefits that CQRS brings is in simplicity to the codebase & design. By separating the query side from the write (even over a consistent store):
  • querying can be more efficient (both the creation of queries & their execution)
  • domain entities need not expose query methods (keeping their responsibilities cleaner)
  • database access requirements can generally become far simpler, obviating arguments for ORM like techs (which introduce their own issues for ownership & dev)

I have witnessed these benefits and their consequences at first hand, and I am sure that others could contribute (and probably have) additional benefits to be found.

So I would argue that CQRS (as described by Greg on his blog) does not need eventual consistency between the query and command sides, and that introducing this unnecessarily is to introduce unnecessary costs both to development and ownership. The question then becomes perhaps, if CQRS is applied with eventual consistency between query side & command side does it exhibit CQS like properties? Here I think the argument is more blurred that you suggest. I don't think that it exhibits all no (because referential transparency is lost) but I do think that you take your argument too far (it feels almost like an exegesis) by placing such a firm emphasis on the DbC aspects. I don't think such an obvious reading is possible. Either way, I'm not sure such debates over original intent are entirely helpful. I believe my reading of Meyer can be justified by reference to the OOSC text but I'm not about to engage in that because I recognise a level of veracity in what I understand from your writing.

Coming back to the original point of departure however, does CQRS extend CQS (I can't remember what Casey said originally exactly) I think that at the very least it certainly can (the implementation to which Casey refers certainly did). Will all implementations, probably not - should most, in my reasoned opinion, yes. Most solutions are not building a competitor to Amazon, nor building algorithmic trading platforms. Not all the lessons from those kinds of development will be applicable to all other projects.

Personally I find many aspects of Casey's post open to critique but as someone who was involved in the project he refers to I have a different perspective on what happened there and am not prepared to do more than keep an, I hope, dignified silence on the matter. His assertion about CQS, or the utility of non-CQRS approaches are not amongst those criticisms however.

Anything which draws me back to Meyer & challenges my understanding of his work is a good thing, so thank you for that,

Neil

Simon Harris

unread,
Nov 4, 2010, 9:23:21 AM11/4/10
to ddd...@googlegroups.com

>> Hmmm i must beg to differ. I don't need eventual consistency but if i consider events as the protocol, it provides me with great opportunity to separate the construction of the UI from that of the core domain model.
>
>
> True. But for that purpose you can also consider implementation around MVC and Presentation Model.

Indeed I can use one of many approaches however none are trivial, all have with pros and cons thus I cannot see a basis for concluding that one in particular is a waste. For me, the conceptual simplicity of the architecture (ignoring eventual consistency concerns) was and still is highly attractive. I'm finding it much more closely aligns with my mental model than other solutions i have attempted in the past.

Simon Harris

unread,
Nov 4, 2010, 9:31:09 AM11/4/10
to ddd...@googlegroups.com, ddd...@googlegroups.com
Which one of his books, and how did you get a PDF of it? I can't find electronic versions of any of his books :(

Neil Robbins

unread,
Nov 4, 2010, 9:33:22 AM11/4/10
to ddd...@googlegroups.com
Object Oriented Software Construction 2nd Edition - it comes with a CD that contains the full text as pdfs (annoyingly for Kindle, as lots of PDFs)

Neil Robbins

unread,
Nov 4, 2010, 9:34:25 AM11/4/10
to ddd...@googlegroups.com
Wow, just saw that price on Amazon.com - maybe they've a cheaper edition or something - otherwise the UK one is much, much cheaper

Mark Nijhof

unread,
Nov 4, 2010, 9:37:10 AM11/4/10
to ddd...@googlegroups.com
It should be stale now, just ordered 2 copies <grin/> <joking/>

--
Mark Nijhof
m: 0047 95 00 99 37
e:  mark....@cre8ivethought.com
b:  cre8ivethought.com/blog/index

"Walking on water and developing software from a specification are
easy if both are frozen."

-- Edward V Berard

Simon Harris

unread,
Nov 4, 2010, 9:45:05 AM11/4/10
to ddd...@googlegroups.com
Just ordered a copy from the book depository. Thanks!

--
Simon Harris
t: @haruki_zaemon

Greg Young

unread,
Nov 4, 2010, 9:46:29 AM11/4/10
to ddd...@googlegroups.com
OOSC is one of the books that I recommend to everyone. It is imho the best book to learn the underlyings of OO.
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer de votre attention

Nuno Lopes

unread,
Nov 4, 2010, 10:02:55 AM11/4/10
to ddd...@googlegroups.com
Hi Simon.

> For me, the conceptual simplicity of the architecture (ignoring eventual consistency concerns) was and still is highly attractive. I'm finding it much more closely aligns with my mental model than other solutions i have attempted in the past.

Don't understand why CQRS is so simple and MVC so complicated.

http://codefish21056.blogspot.com/2010/08/cqrs-mvc.html

Cheers,

Nuno


Nuno Lopes

unread,
Nov 4, 2010, 10:03:57 AM11/4/10
to ddd...@googlegroups.com

OOSC is one of the books that I recommend to everyone. It is imho the best book to learn the underlyings of OO.

+1

Cheers,

Nuno

Tom Janssens

unread,
Nov 4, 2010, 10:35:34 AM11/4/10
to DDD/CQRS
+1

While a lot of things posted on this newsgroup look spectacular, I am
using some kind of "dumbed down" version of CQRS with a lot of
success.
These are the advantages IMHO:

Consistent layering:
I currently use commands, events and queries to separate my app in 3
layers
- Front-end: an MVC infrastructure where the controller either queries
viewmodels or sends commands to the bus and redirects to another
controller method based on the validation of the command.
- Domain layer: interprets commands and delegates them to AR's, which
publish domain events; commands can be executed in a background thread
if they implement the IShouldExecuteAsync interface { bool IsAsync
{get; }}
- Viewmodel layer: updates viewmodels based on the domain events
Storage is as simple as a single table { Guid,Blob } + some specific
tables for viewmodels which can be queried (i.e. search for xxx)
My repository for most of the domain state/viewmodel state contains
only two methods: Fetch<TState>(Guid id) and Modify<TState>(Guid id,
Action<TState> modification)
By using CQRS I got rid of an ORM and AutoMapper => lots of
overhead...
I could separate the views from the domain easily but I don't need it
ATM.

Integration testing is a breeze now:
- send some events to the bus
- send a command
- check whether some events occurred
BDD does not really require gherkin language any more since commands
and events are understandable by the domain experts.

Currently event sourcing is not used here, but I am considering it,
since it would make refactoring/altering the domain state
effortless...

Nuno Lopes

unread,
Nov 4, 2010, 11:02:48 AM11/4/10
to ddd...@googlegroups.com
Hi Neil, thank you for your reply,

Eventual consistency is something that is particularly painful to accept within a system. 

Not really. Usually it is usually quite acceptable between bounded contexts. At least In my experience.

One of the key benefits that CQRS brings is in simplicity to the codebase & design. By separating the query side from the write (even over a consistent store):
  • querying can be more efficient (both the creation of queries & their execution)
  • domain entities need not expose query methods (keeping their responsibilities cleaner)
  • database access requirements can generally become far simpler, obviating arguments for ORM like techs (which introduce their own issues for ownership & dev)
I've been using ORM's for quite awhile. Like Evans my experience with OO is on par with Relational systems. Directly accessing the database to perform queries for UI purposes, bypassing the model is quite a norm around here. 

I strongly advise this practice as it is a Win Win situation. Yes you probably loose some independence to database tech, but nothing you can't tackle with repositories. Added to this, creating Views over a relational database is a snap.

Try using an ORM for object persistence and the relational model for queries. You will find the same benefits you argue with no events.

Greg's ideas makes the case of a cohesive set of benefits in his approach. When you start pealing his approach of its one by one benefits because you just need part of it, other solution exist that speed up the development greatly IMHO.

Greg's for instance makes a strict interpretation of AR. Point being that two of his ARs may be eventually consistent. (no UoW across ARs) This makes the system extremely flexible in terms data deployment, yet other have also argued that this interpretation its just one amongst other. Leading to conclude that a lot of people use UoW across ARs.

Still, you can Greg's AR interpretation with an ORM.

So I would argue that CQRS (as described by Greg on his blog) does not need eventual consistency between the query and command sides, and that introducing this unnecessarily is to introduce unnecessary costs both to development and ownership. 

True,  true. But simpler approaches exist in such cases IMHO. Read the above.

Across BCs we would need 2PC in order to keep things consistent but it is costly in high volume transaction systems. So we don't usually do this around here. So systems are eventually consistent.

Around here, though we don't use event's yet for system integration, mostly because of technical difficulties and culture. For instance integrating our backend services with Sales Force using events is hard since there isn't has of yet a common Bus. So we need to use standard SISS for batch uploads, computing differentials each time along with logs. ES would simplify that greatly, along with ES for auditing and correctness. 

So I see great benefit on CQRS in terms integration of BCs even if we don't use ARs as Greg does. The bottom line for me is indeed the need for eventually consistent BCs. In my experience, is that even if there are no scalability issues, we sometimes are forced by the technology.

"From the Command-Query Separation principle follows a style of design that yields simple and readable software, and tremendously helps reliability, reusability and extendibility." (handily I keep the pdf copy of his work on my laptop & my kindle as it is one of the few texts which I find myself returning too again & again)

I don't think that anyone would argue that eventual consistency leads to simple and readable software, nor help reliability (not the same thing as availability). It may help extendibility, but I think even that would be open to debate. Note I am not discussing EAI scenarios here (say updating the corporate CRM from a LOB system) where such qualities as referential transparency are less of a benefit. I am particularly considering the relationship between the query and command parts of a system.

That is basically my point. So CQS becomes a mute property in those circumstances. In the circuntances where we don't need eventual consistency I would advise other techniques which makes the CQS on CQRS a mute point once again.

Cheers,

Nuno


Neil Robbins

unread,
Nov 4, 2010, 11:25:32 AM11/4/10
to ddd...@googlegroups.com
On Thu, Nov 4, 2010 at 4:02 PM, Nuno Lopes <nbpl...@gmail.com> wrote:
Hi Neil, thank you for your reply,

Eventual consistency is something that is particularly painful to accept within a system. 

Not really. Usually it is usually quite acceptable between bounded contexts. At least In my experience.



But the context here is not one between bounded contexts, but between the query and command parts of the same context. The trade off is very different.
 
One of the key benefits that CQRS brings is in simplicity to the codebase & design. By separating the query side from the write (even over a consistent store):
  • querying can be more efficient (both the creation of queries & their execution)
  • domain entities need not expose query methods (keeping their responsibilities cleaner)
  • database access requirements can generally become far simpler, obviating arguments for ORM like techs (which introduce their own issues for ownership & dev)
I've been using ORM's for quite awhile. Like Evans my experience with OO is on par with Relational systems. Directly accessing the database to perform queries for UI purposes, bypassing the model is quite a norm around here. 

I strongly advise this practice as it is a Win Win situation. Yes you probably loose some independence to database tech, but nothing you can't tackle with repositories. Added to this, creating Views over a relational database is a snap.

Try using an ORM for object persistence and the relational model for queries. You will find the same benefits you argue with no events.



This is basically what I'm advocating and I would see this as a vanilla CQRS implementation. The only point of departure for me would be to consider not using an ORM on the command side - but whatever works for you or your team, I don't think it's a big deal in this context.

 
Greg's ideas makes the case of a cohesive set of benefits in his approach. When you start pealing his approach of its one by one benefits because you just need part of it, other solution exist that speed up the development greatly IMHO.

Greg's for instance makes a strict interpretation of AR. Point being that two of his ARs may be eventually consistent. (no UoW across ARs) This makes the system extremely flexible in terms data deployment, yet other have also argued that this interpretation its just one amongst other. Leading to conclude that a lot of people use UoW across ARs.

Still, you can Greg's AR interpretation with an ORM.

So I would argue that CQRS (as described by Greg on his blog) does not need eventual consistency between the query and command sides, and that introducing this unnecessarily is to introduce unnecessary costs both to development and ownership. 

True,  true. But simpler approaches exist in such cases IMHO. Read the above.

Across BCs we would need 2PC in order to keep things consistent but it is costly in high volume transaction systems. So we don't usually do this around here. So systems are eventually consistent.


Again, I'm not referring to eventual consistency between systems (entirely different set of arguments apply here), but to the eventual consistency within a context (between its query and command parts).

 
Around here, though we don't use event's yet for system integration, mostly because of technical difficulties and culture. For instance integrating our backend services with Sales Force using events is hard since there isn't has of yet a common Bus. So we need to use standard SISS for batch uploads, computing differentials each time along with logs. ES would simplify that greatly, along with ES for auditing and correctness. 

So I see great benefit on CQRS in terms integration of BCs even if we don't use ARs as Greg does. The bottom line for me is indeed the need for eventually consistent BCs. In my experience, is that even if there are no scalability issues, we sometimes are forced by the technology.


I would entirely agree, but again, see the context that I'm trying to address above. I have worked on systems that successfully integrate with the wider contexts/enterprise through messaging, but do not use those messages internally to the BCs. I can see the benefits of things like ES which leverage the messages within a BC too but this is not going to always be the best way for things to be done. 
 
"From the Command-Query Separation principle follows a style of design that yields simple and readable software, and tremendously helps reliability, reusability and extendibility." (handily I keep the pdf copy of his work on my laptop & my kindle as it is one of the few texts which I find myself returning too again & again)

I don't think that anyone would argue that eventual consistency leads to simple and readable software, nor help reliability (not the same thing as availability). It may help extendibility, but I think even that would be open to debate. Note I am not discussing EAI scenarios here (say updating the corporate CRM from a LOB system) where such qualities as referential transparency are less of a benefit. I am particularly considering the relationship between the query and command parts of a system.

That is basically my point. So CQS becomes a mute property in those circumstances. In the circuntances where we don't need eventual consistency I would advise other techniques which makes the CQS on CQRS a mute point once again.


I guess then this is the fundamental point of departure - I find that the knub (vanilla if you like) of CQRS can offer a lot of value without need for the other patterns that often (and with good reason) accompany it (such as ES, Messaging, etc...).
 
Cheers,

Nuno



Greg Young

unread,
Nov 4, 2010, 11:28:17 AM11/4/10
to ddd...@googlegroups.com
I agree that there is benefit without eventual consistency, this has been seen time after time on real-world systems.

That said, I like eventual consistency because it forces you to ask questions and better understand the domain.

Nuno Lopes

unread,
Nov 4, 2010, 11:42:13 AM11/4/10
to ddd...@googlegroups.com
Hi,


Try using an ORM for object persistence and the relational model for queries. You will find the same benefits you argue with no events.



This is basically what I'm advocating and I would see this as a vanilla CQRS implementation. The only point of departure for me would be to consider not using an ORM on the command side - but whatever works for you or your team, I don't think it's a big deal in this context.


In that case Peace :). But I find it hard to technically persist objects an relational database while maintaining the ability to use its query facilities without an ORM. An ORM is basically the realization of the idea of mapping a OO schema to a relational schema. You can use whatever ORM you want, even build one yourself of course. Still CQS here is also a mute point.

So I tend to think and discuss CQRS as well as MVC in an eventually consistent environment, which makes CQS a mute point to. Why MVC? Because UIs are by definition also eventually consistent.

Cheers,

Nuno



Neil Robbins

unread,
Nov 4, 2010, 11:51:56 AM11/4/10
to ddd...@googlegroups.com
One technique (at least with SQL Server) is to persist the object as XML and use views over that to provide a consistent, but simple, source for queries. Of course the pain then is moved to the generation of these views, but it's very similar (& generally more acceptable to corp. culture) to using something like CouchDB with secondary indexes (accept of course for how the views are described and generated). It does make persistence quite trivial though, maintains consistency, & provides similar benefits for querying to the full blown messaging solution (essentially this work is delegated to the RDBMS/DocDB). To scale out then it's a simple matter to replicate the read side out to slaves, implement sharding, use caching, or do any number of other things. The point at which it becomes necessary (though virtues of scale) to abandon a fully consistent view within a BC can then be deferred to a very extreme point.

I think such designs address some of the issues that Casey raises (& ironically are partly for me the fruit of much conversation with him a couple of years ago).


(for the record I do think that Event Sourcing has a place & that is not connected with scaling - but that's another story)

Nuno Lopes

unread,
Nov 4, 2010, 12:13:37 PM11/4/10
to ddd...@googlegroups.com
A last note Neil since I just noticed the rest of the post.

> But the context here is not one between bounded contexts, but between the query and command parts of the same context. The trade off is very different.

> Again, I'm not referring to eventual consistency between systems (entirely different set of arguments apply here), but to the eventual consistency within a context (between its query and command parts).

Why do you assume that on top of a View is the UI and immediately the user? Couldn't there be another BC reading data from the view and making decisions over it? It may as a result send a command back to the BC but not necessarily.

Quite often the Application Layer were Views reside are used as integration points (composites).

Cheers,

Nuno

Neil Robbins

unread,
Nov 4, 2010, 12:22:15 PM11/4/10
to ddd...@googlegroups.com
I'm not assuming this at all - the nature of the BC's client is surely immaterial? I'm not sure how what I've written could be interpreted as making that assumption but it wasn't intended.

Nuno Lopes

unread,
Nov 4, 2010, 12:26:46 PM11/4/10
to ddd...@googlegroups.com
Hi Neil.

Try using an ORM for object persistence and the relational model for queries. You will find the same benefits you argue with no events.
- Nuno


This is basically what I'm advocating and I would see this as a vanilla CQRS implementation. - Neil

One technique (at least with SQL Server) is to persist the object as XML and use views over that to provide a consistent, but simple, source for queries.  - Neil

We are not advocating the same things then. Because that would be in terms of performance a very silly thing to do, especially if you want to get any value from query abilities of SQL Server. You basically loose the ability to benefit from indexes from queries etc etc. A dead end in technical terms leading the us to scale out views.

What you suggest is the IMHO the perfect example where the solution starts to bend to some canonical technical implementation of a pattern. 

Cheers,

Nuno

Neil Robbins

unread,
Nov 4, 2010, 12:27:16 PM11/4/10
to ddd...@googlegroups.com
Only thing I'd add to that commendation (whilst totally agreeing with it), is that it is a very technical study of OO (a fantastic one, but still very technical take). It presents a view which is clearly in favour of type safe, class based languages.

I'd recommend also going and reading something like Object Thinking by Alan Kay to get more of the cuddly/hippy (dare I say culty) soft-thinking that also goes with the OO space.

Neil Robbins

unread,
Nov 4, 2010, 12:29:33 PM11/4/10
to ddd...@googlegroups.com
That's your view, but not my experience or view. Don't see why performance is lost. Writes tend to be plenty quick enough. Querying views is just fine (and can be denormalised). Why would it be a dead-end in technical terms?

Ian Cooper

unread,
Nov 4, 2010, 12:42:56 PM11/4/10
to DDD/CQRS
Hi Neil,

> So what benefits might I see in CQRS without eventual consistency? One of
> the key benefits that CQRS brings is in simplicity to the codebase &
> design. By separating the query side from the write (even over a consistent
> store):
>    - querying can be more efficient (both the creation of queries & their
>    execution)
>    - domain entities need not expose query methods (keeping their
>    responsibilities cleaner)
>    - database access requirements can generally become far simpler,
>    obviating arguments for ORM like techs (which introduce their own issues for
>    ownership & dev)

We came to CQRS by virtue of the issues we experienced with a classic
layered architecture that funnelled both read and write through the
domain, with unecessary complexity around building our viewmodel (both
from the need to issue multiple queries through touching many ARs and
code to map multiple DTOs that often carried far more data than we
needed into a single view model). Letting the presentation layer talk
to the Data layer and use a transaction script approach, freed us from
the tyranny of our domain. We also as a reinforcement slimmed down Fat
Controllers and Domain Services.

We didn't break from an ORM for this though the probelms caused by the
loss of information hiding from being forced to expose our entities'
state properties and the tendency of devs to use once it was exposed
would be a good reason for me to consider shifting to a reflection
based home rolled one. We wanted the caching support because we were
metadata heavy, but I can certainly see a model that could obviate the
need for a 2nd level cache by pre-claculating the outcome of metadata
from writes so that reads neer needed to figure it out, and making
sure that my SQL server buffer was large enough. That's food for
thought to resolve smells around ORMs that still trouble me

> So I would argue that CQRS (as described by Greg on his blog) does not need
> eventual consistency between the query and command sides, and that
> introducing this unnecessarily is to introduce unnecessary costs both to
> development and ownership.

I think that discussions of using event sourcing to scale have clouded
the picture. My understanding from what I see Greg talk about is that
capturing the transactional nature of the domain is the driver behind
event sourcing not scaling (although that you can use it to scale is
of utility). That is why I would tend to pitch event sourcing as a
domain concept not as a infrastructure concept. Indeed we used it
within our domain to solve specific issues of a highly transactional
domain (insurance) and used it to solve complex transactional problems
(out-of-sequence mid-term adjustments) that plague many systems in
that space. IIRC the first time I remember Greg talking about event
sourcing he hedged it in terms of the failure of audit trails and
asking yourself the question, what is my audit trail requirement for,
how would it be used, and how could it be proved is the first step to
seeing where event sourcing comes in your domain. But yes, talk of
'how does Amazon' scale' is I think something of a red-herring.

Ian

Nuno Lopes

unread,
Nov 4, 2010, 12:44:34 PM11/4/10
to ddd...@googlegroups.com
Hi Neil.


I'm not assuming this at all - the nature of the BC's client is surely immaterial? I'm not sure how what I've written could be interpreted as making that assumption but it wasn't intended.

I'm starting to loose track of this conversation. But I the reason whyI assumed is that I've never talk to a person that thoughts that what you see on the screen is fully consistent with what is in the model, as such it becomes a problem. Especially when the only loop that exists is between  view - ui - model - view ..... . Which is basically the case of MVC. This, as long as business rules are enforced in the model, at least is the case with MVC as such the way I use CQRS, which reduces the impact of making the right decision at the wrong time.

What isn't so trivial to assume at first stance is that what is in a view can drive decision on some other context, case in case another BC. Because in this case, there might be no feed back loop to the model. But I've found that provided the system has some check points and structures (such as auditing), this is usually acceptable. In these cases ES becomes important, at least to me.

Cheers,

Nuno

Neil Robbins

unread,
Nov 4, 2010, 12:57:01 PM11/4/10
to ddd...@googlegroups.com
Don't think I'd disagree with anything there Ian.

What I might do though is to go as far (is it far?) as to suggest that Event Sourcing with separate query stores (so as typically done in this community & articulated by people like Mark Nijhof & Greg) and Full Consistency are not mutually exclusive and that the choice to drop consistency (between command and query store) is a choice we get to make with costs/benefits to assess which will differ between different situations.

I can use distributed (& therefore nested) transactions if I choose (however implemented). Yes this will come at a cost (not getting into that debate right now :), but so does accepting eventual consistency (again between command & query - not between BCs or other EAI scenarios). In different situations (perhaps within different BCs of a system) the choice will look different.

Someone posted just now asking a question about a scenario they have where a user needs to see the items that they add to their shopping basket. My first thought on seeing this was - well don't make that eventually consistent unless the cost of not doing is going to justify the pain you're about to incur to solve your problem.

Still I know you appreciate the ability to adopt different techniques within the different contexts of a system as I've enjoyed discussing this with you in the past & hearing you speak on the subject.

Neil Robbins

unread,
Nov 4, 2010, 1:07:49 PM11/4/10
to ddd...@googlegroups.com
I think, if I've understood you, that my perspective might be quite different -although I recognise that in different contexts this is to be expected.

Most users I know do expect the screen to be consistent with the model. If I put a book in my shopping basket I'm sorely disappointed if it's no longer available when I get to the end of the purchasing process.

Most organisations are still used to updates of systems which lag. So that the CRM might be out of sync with a transactional system by a day is generally accepted, users know how to work around that problem. Likewise if the details of a new insurance policy aren't available to the claims handler should the policy holder attempt to notify a loss in the first day that they took out their policy (perhaps longer depending on the brokers involved). Organisations tend to have processes to work around these issues.

If however I'm the underwriter (well assistant underwriter, lets keep this realistic) and I create a new policy in the system I expect that policy to be present when I go to view it & I expect, perhaps more importantly, that the quotes for that customer will not allow me to create a further policy for that customer from them. When I see that quote (even if I've had the 0.5 day training) I'm likely to try and create the quote again. (yes we can then jump through hoops however seemingly trivial to deal with that users problem).

By not giving up consistency within these contexts (within - not between) then I think that our lives as developers, and as users, are markedly simpler (so less cost) - let alone the cost of monitoring, troubleshooting, support, etc... none of which is trivial. I'm not saying to never give this up - but that it is a very reasonable choice in a lot of situations to not do so, and that large benefits can still be had.

Ian Cooper

unread,
Nov 4, 2010, 1:25:16 PM11/4/10
to DDD/CQRS


On Nov 4, 4:57 pm, Neil Robbins <neilarobb...@gmail.com> wrote:
> What I might do though is to go as far (is it far?) as to suggest that

I think Greg and I had a discussion that the best way to outline a lot
of this was narratives+patterns Fowler style.

As part of that I think that it would be worth outlining what you need
to compensate for in each combination of the various techniques i.e.
if you choose CQRS with Full Consistency what do you need to win/lose,
what are your compensation strategies for that. I think that would
help folks deal with constraints that they have, select an appropriate
response, and understand the cost of what they have chosen.

Nuno Lopes

unread,
Nov 4, 2010, 1:42:56 PM11/4/10
to ddd...@googlegroups.com
Hi,

> Most users I know do expect the screen to be consistent with the model. If I put a book in my shopping basket I'm sorely disappointed if it's no longer available when I get to the end of the purchasing process.


Humm. I think the users expect that what they see is consistent to with their inputs. No so much consistent with some back end system. They do understand, that it might be the case that when some input is provided it might still be rejected, even though it seams consistent with what they view, simply because conditions have changed. As long has this does not happen systematically is not considered a bug, but an effect of concurrent access, whose cost is less then sending a fax.

> If however I'm the underwriter (well assistant underwriter, lets keep this realistic) and I create a new policy in the system I expect that policy to be present when I go to view it & I expect, perhaps more importantly, that the quotes for that customer will not allow me to create a further policy for that customer from them. When I see that quote (even if I've had the 0.5 day training) I'm likely to try and create the quote again. (yes we can then jump through hoops however seemingly trivial to deal with that users problem).

The problem you describe is when the Policy is submitted and considered correct by the system and does not appear listed in the next screen (for instance), not so much when it is considered incorrect. Provided that the system is able to present the submitted policy in a workable time frame there is no problem. One way commands are not very in situation where the system is available. If not available, there is some value still in being able to submit the policy event though is not immediately processed. So adaptable system that would take into consideration different types of responses.

> By not giving up consistency within these contexts (within - not between) then I think that our lives as developers, and as users, are markedly simpler (so less cost) - let alone the cost of monitoring, troubleshooting, support, etc... none of which is trivial. I'm not saying to never give this up - but that it is a very reasonable choice in a lot of situations to not do so, and that large benefits can still be had.

Yes, it needs to be a business decision in terms of what is the cost of having a feature if not the entire system down. No doubt. That is why we don't have a green light for this yet. But shouldn't that be always the case?

Cheers,

Nuno

Raoul Duke

unread,
Nov 4, 2010, 1:50:37 PM11/4/10
to ddd...@googlegroups.com
On Thu, Nov 4, 2010 at 10:25 AM, Ian Cooper
<ian.hammo...@gmail.com> wrote:
> As part of that I think that it would be worth outlining what you need
> to compensate for in each combination of the various techniques i.e.
> if you choose CQRS with Full Consistency what do you need to win/lose,
> what are your compensation strategies for that. I think that would
> help folks deal with constraints that they have, select an appropriate
> response, and understand the cost of what they have chosen.

+lots.

Udi Dahan

unread,
Nov 4, 2010, 3:07:11 PM11/4/10
to ddd...@googlegroups.com

> That said, I like eventual consistency because it forces you to ask questions and better understand the domain.

 

Big +1 from me.

 

-- Udi Dahan

No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 9.0.864 / Virus Database: 271.1.1/3235 - Release Date: 11/03/10 08:36:00

Simon Harris

unread,
Nov 4, 2010, 3:57:50 PM11/4/10
to ddd...@googlegroups.com
>> I think that discussions of using event sourcing to scale have clouded
> the picture. My understanding from what I see Greg talk about is that
> capturing the transactional nature of the domain is the driver behind
> event sourcing not scaling (although that you can use it to scale is
> of utility). That is why I would tend to pitch event sourcing as a
> domain concept not as a infrastructure concept... talk of

> 'how does Amazon' scale' is I think something of a red-herring.

Hear hear. Whatever anyone elses reasons for adopting ES, mine has nothing to do with scaling and everything to do with capturing the semantics and intent of the domain. I write code in the hope that it captures the language, intent, and understanding of the domain and it's experts. In ES I see and experience a way (not the only way) to elegantly do the same at a fundamental level. When my code is composed of methods that reflect the way i interpret the domain operates, it helps explain and understand how to use it now and in the future. When the effect of those operations are captured in a similarly semantic way, it helps explain and understand how the system was used in the past. As mentioned previously, i also like that the events can act as a protocol when communicating this activity and they do so in a semantic way. I cannot deny that in place updates work sufficiently well for, and reflect the mental models of many people just as one cannot deny that I find ES to be better for me.

Simon Harris

unread,
Nov 4, 2010, 4:16:20 PM11/4/10
to ddd...@googlegroups.com
On 05/11/2010, at 1:02, Nuno Lopes <nbpl...@gmail.com> wrote:

> Hi Simon.
>
>> For me, the conceptual simplicity of the architecture (ignoring eventual consistency concerns) was and still is highly attractive. I'm finding it much more closely aligns with my mental model than other solutions i have attempted in the past.
>
> Don't understand why CQRS is so simple and MVC so complicated.

I never made the implied assertion.

Nuno Lopes

unread,
Nov 4, 2010, 4:37:40 PM11/4/10
to ddd...@googlegroups.com
Hi Simon,

>>>
>>> Hmmm i must beg to differ. I don't need eventual consistency but if i consider events as the protocol, it provides me with great opportunity to separate the construction of the UI from that of the core domain model.
>>
>>

>> True. But for that purpose you can also consider implementation around MVC and Presentation Model.
>
> Indeed I can use one of many approaches however none are trivial, all have with pros and cons thus I cannot see a basis for concluding that one in particular is a waste. For me, the conceptual simplicity of the architecture (ignoring eventual consistency concerns) was and still is highly attractive. I'm finding it much more closely aligns with my mental model than other solutions i have attempted in the past.

I guess you made the statement in comparison so I assumed your answer was also in comparison.

I should probably state that the context of my assessment that concluded in "waste" was one where CQRS is applied to fully consistent systems not in an eventually consistent. In which case I mentioned other patterns above that in my view offer simpler an alternatives. We could also mention NakedObjects.

I've been developing web apps since Mosaic. Never felt the need for CQRS in relationship to the UI. But I did felt about MVC.

> Hear hear. Whatever anyone elses reasons for adopting ES, mine has nothing to do with scaling and everything to do with capturing the semantics and intent of the domain.

Mine is in allowing the user making more informed decision iff they feel the need. In some domains is actually a requirement, other not so much. Eventually consistent systems just enforces the need in some cases, in other cases becomes mandatory.

Nuno

>> Hi Simon.
>>
>>> For me, the conceptual simplicity of the architecture (ignoring eventual consistency concerns) was and still is highly attractive. I'm finding it much more closely aligns with my mental model than other solutions i have attempted in the past.
>>
>> Don't understand why CQRS is so simple and MVC so complicated.
>

> I never made the implied assertion. - Simon

Nuno Lopes

unread,
Nov 4, 2010, 4:45:02 PM11/4/10
to ddd...@googlegroups.com

> That said, I like eventual consistency because it forces you to ask questions and better understand the domain.
 
Big +1 from me.

+1 from me too. 

But still, even if some rule can be "relaxed" it does not mean we need to implement our systems in such way unless the business puts some value over it. Other methods exist, such as "assume nothing about a business rule" which is quite a difficult exercise, especially for programmers.

Reply all
Reply to author
Forward
0 new messages