Live data from Hacker News

Show HN: Learn what DDD, CQRS, and event-sourcing are all about

docs.wolkenkit.io

21–30 of 86 posts

Re: Show HN: Learn what DDD, CQRS, and event-sourcing are all about

#21
post #17

Earlier quoted context omitted.

I'm currently writing a book about CQRS/ES I'd be glad of your notes about it's downsides.

Workflows for which some steps depends on things: the current real state of an entity, the permissions the current user has etc. In a client-server system like a web API where you want to respond to the client as fast as possible having to reconstruct your entity from snapshot + some history can take some time. So you end-up with corrective events and responses which are "we have noted your request, poll us to know t…

On the CQRS+ES project I worked on for two years, we were just thinking about the happy path at first before realizing that was a mistake.

For your example, here are two approaches depending on your implementation and your tolerance for edge cases and eventual consistency:

- you can enter into a saga which would do a two phase commit, ensuring that the user is indeed authorized when the edit is made. All possible states are captured in your event model and so your event history will always show what has happened

- you can load the document aggregate when you process the command and query it at that time, throwing an exception if the user is not authorized and then you can notify the user or send another command. In this case, your event model does not have to include events that describe the violation of domain rules

The first option gives you the guarantee you are looking for, but comes at the cost of complexity. The second option will give you the correct results unless a user is deauthorized before the edit command completes. Some systems process all commands in serial and so it would not be a problem. Some systems partition their commands to distribute the work and so this edge case can occur.

But you can select what makes most sense for you.

Re: Show HN: Learn what DDD, CQRS, and event-sourcing are all about

#22
post #16

While event sourcing is a quite alright tech for certain problems, this idea of "one solution fits all" is just ridiculous. Also the idea of "eventual consistency" is highly situational particularly in an distributed solution. Paradoxically looking at one event source log this looks like a great idea, but there are no guarantees that events propagate evenly and "in-order" so even if events happen and there's "nothing…

And by "one solution fits all" I mean CQRS.

Re: Show HN: Learn what DDD, CQRS, and event-sourcing are all about

#23
post #20
post #16

While event sourcing is a quite alright tech for certain problems, this idea of "one solution fits all" is just ridiculous. Also the idea of "eventual consistency" is highly situational particularly in an distributed solution. Paradoxically looking at one event source log this looks like a great idea, but there are no guarantees that events propagate evenly and "in-order" so even if events happen and there's "nothing…

This is a problem in how lots of people do event sourcing, but its not a fundamental problem with event sourcing. If you enforce strict ordering of events throughout your stack and do operation catchup properly, these sorts of bugs are completely avoidable.

Well that's the entire problem, you are not the one making the requirements, the solution of the problem does... You can't eat dinner before you have made it.

Edit: I would argue that you can't write a system which is open (several domains) and believe that you will have entirely independent events throughout the system and claim that your system will be "bugfree"/correct.

Re: Show HN: Learn what DDD, CQRS, and event-sourcing are all about

#24
post #18

Earlier quoted context omitted.

I'm currently writing a book about CQRS/ES I'd be glad of your notes about it's downsides.

I think many people just dislike DDD and CQRS/ES because it's associated with over engineering. Either you are really good and get things right without much help, which isn't often the case, or you end up in two other directions. You over-engineer with DDD/CQRS/ES. You under-engineer without them. Most developers I met preferred the last solution, probably because they end up with their "own" mess and not the mess of…

For some projects, ES isn't over-engineering. It can be useful when writing to a database is too slow, for example.

Re: Show HN: Learn what DDD, CQRS, and event-sourcing are all about

#25
post #8

There is a disconnect in your messaging. Here on HN the title is "Learn what DDD, CQRS, and event-sourcing are all about", but the tagline in the PDF is "The semantic JavaScript backend for event-driven development". So, what's this about? about DDD, CQRS and event-sourcing, or about a particular Javascript framework? Those two aren't the same at all (even though I suspect there is a little overlap).

The brochure is to 2/3s an introduction to DDD, CQRS, and event-sourcing in general, not being related to a specific JavaScript framework. The last 1/3 shows how to apply these concepts using wolkenkit, which is a specific framework. When we created the brochure it seemed important to us to first explain the concepts in a neutral way, because we want to help people gain a better understanding of these concepts, no ma…

That's great. My point is that the title page does not properly represent that.

You might have an easier time getting people to read it when they don't get the impression "it's just another javascript framework".

Re: Show HN: Learn what DDD, CQRS, and event-sourcing are all about

#26

Reshaping data is the source of so many costly bugs and communications breakdowns in this world. CQRS is like descending to the 8th circle, pit 7 of reshaping hell. What fetish drives one to such tortures? If your schema is any more complicated than a plain stream of characters, and you pick CQRS for your app, then you are an overpaid, bored, architecture astronaut consultant looking to pad his resume. Nevermind the…

CQRS just simply means your queries, and commands have separate paths.

This can be as simple or as complicated as someone wants to make it.

It could be as simple as having commands operate on a domain object, but the queries returning a fully populated view object from some custom sql.

Re: Show HN: Learn what DDD, CQRS, and event-sourcing are all about

#27
Can anyone explain why eventual consistency is so scary? The way I see it, eventual consistency is everywhere. Even in your non-distributed synchronous CRUD app. The minute you start two db transactions within one script you have eventual consistency. You have to deal with the fact that one transaction can fail and that your state can be inconsistent.

Re: Show HN: Learn what DDD, CQRS, and event-sourcing are all about

#28
post #27

Can anyone explain why eventual consistency is so scary? The way I see it, eventual consistency is everywhere. Even in your non-distributed synchronous CRUD app. The minute you start two db transactions within one script you have eventual consistency. You have to deal with the fact that one transaction can fail and that your state can be inconsistent.

It really depends on the application. Eventual consistency means that eventually, the databases will be consistent.

Some bank transactions, for example, do not have that luxury because it might allow 2 possible answers to the same query if the eventuality has not been met.

Some trading transactions don't have that luxury either because the milliseconds that you waited for the consistency a stock might have changed its price dramatically.

It really depends on the Domain if the time to wait for the eventuality is acceptable or not.

Re: Show HN: Learn what DDD, CQRS, and event-sourcing are all about

#29

Earlier quoted context omitted.

I'm currently writing a book about CQRS/ES I'd be glad of your notes about it's downsides.

Pragmatic handover of released code and DB to a less technical CRUD team. Avoiding unproven non-anecdotically solutions like EventStore yet still shipping quickly. Avoiding becoming an F#/Scala snob or a JavaScript monkey.

Well it's pretty proven, it's just also likely overkill for what you need. Use it in your personal hobby projects so that you know the costs, and benefits. That way you don't blindly apply it where it doesn't fit (which admittedly will be most places).

Re: Show HN: Learn what DDD, CQRS, and event-sourcing are all about

#30
post #17

Earlier quoted context omitted.

Workflows for which some steps depends on things: the current real state of an entity, the permissions the current user has etc. In a client-server system like a web API where you want to respond to the client as fast as possible having to reconstruct your entity from snapshot + some history can take some time. So you end-up with corrective events and responses which are "we have noted your request, poll us to know t…

On the CQRS+ES project I worked on for two years, we were just thinking about the happy path at first before realizing that was a mistake. For your example, here are two approaches depending on your implementation and your tolerance for edge cases and eventual consistency: - you can enter into a saga which would do a two phase commit, ensuring that the user is indeed authorized when the edit is made. All possible sta…

> Some systems partition their commands to distribute the work and so this edge case can occur.

So basically don't introduce race conditions that aren't inherently part of the domain. This seems like a modelling failure to me.

Post reply on HN