News for hackers. Stuff that matters.
Re:Building a CQRS/ES web application in Elixir using Phoenix by arcbyte on Friday January 06, 2017 @02:39PM (#13339470)
> CQRS library

You missed the whole point of CQRS

Re:Building a CQRS/ES web application in Elixir using Phoenix by bglusman on Friday January 06, 2017 @03:01PM (#13339675)
Would you care to expand on what "the whole point" of CQRS is, or how they missed it? You seem to imply that the existence or creation of a library to support the pattern is, in some sense, against the spirit of the pattern, which is a) not at all obvious to me, and b) seems like something you should expand upon if you're criticising the article and/or author for HN's civil dialogue guidelines.
Re:Building a CQRS/ES web application in Elixir using Phoenix by realntl1 on Friday January 06, 2017 @03:38PM (#13339964)
I think CQRS is more commonly viewed as an architectural pattern, not a code pattern, despite many definitions floating out there on the internet that focus on command/query object patterns. See this post: http://udidahan.com/2009/12/09/clarified-cqrs/. If we view it as an architectural pattern, it becomes folly to think that CQRS can be distilled into a library.
Re:Building a CQRS/ES web application in Elixir using Phoenix by sb8244 on Friday January 06, 2017 @04:32PM (#13340396)
> it becomes folly to think that CQRS can be distilled into a library

Sincerely curious about this statement. I understand that CQRS is an architectural pattern, but couldn't a library implement that architecture and then provide ways for you to implement into that architecture? You don't get to pick the architecture nuances at that point, though.

Re:Building a CQRS/ES web application in Elixir using Phoenix by Terr_ on Friday January 06, 2017 @09:10PM (#13341999)
IMO it's a bit like talking about a "Facade Framework".

Using facades to encapsulate multiple complex objects behind a simpler interface may be an important of your overall design, but even if you use them it a lot you probably don't need (or want) to build a "Facade Framework" that lets you instantly define new ones with a few lines of meta-code.

Any code you make for reuse by other people is going to contain something more in order to have value to them. For example, "A Facade library for dealing with various cloud services".

Relating it back to CRQS, compare "CQRS Framework" to "A CQRS framework for command-line applications" or "A CQRS framework for websites". The CQRS-ness is a quality that can't stand just on its own.

Re:Building a CQRS/ES web application in Elixir using Phoenix by karmajunkie on Friday January 06, 2017 @04:48PM (#13340557)
At its most basic level, CQRS is frankly too simple to take on a dependency as a cornerstone of a project. You can write a single base class that handles all of the responsibilities needed. Its NOT an architecture—its an architectural tool.
Re:Building a CQRS/ES web application in Elixir using Phoenix by kellyleahy on Monday January 09, 2017 @02:30PM (#13359043)
Agreed. This is so true. I've never ended up with a "library" for doing this. At my previous employer we had three different CQRS-based systems and two of the three of them even had completely different implementations for 90% of the CQRS infrastructure. They are both successful implementations and there was no need to share that bit of the code, as the two teams doing things came to different conclusions on how they wanted to write their CQRS code. The only thing we shared was the event store and some of the minor things on top of the event store.
Re:Building a CQRS/ES web application in Elixir using Phoenix by osd on Friday January 06, 2017 @03:22PM (#13339861)
This is a guess, but if I were to have a problem with the term CQRS Library, it is that the query and command sides of CQRS really shouldn't be linked in any way. CQRS is a methodology that stresses that decoupling above all else. If your the command and query portions of your CQRS tech stack both fall under a single library, that seems to go against the methodology.
Re:Building a CQRS/ES web application in Elixir using Phoenix by lucisferre on Friday January 06, 2017 @03:38PM (#13339974)
I know Greg personally, and I have heard him say things like "you don't need a library" in the past. However despite the fact that the basics are simple there are a lot of repeatable concepts that make sense to centralize around and even standardize. There is nothing wrong with a library, just as it is possible to do it without.

One thing that absolutely needs library/drivers is persistence of the event store. I say this having built my own as well as contributing to open source ones in the past. It is still a hard and not well solved problem to do this well. Again it can be simple, but in the real world it isn't usually that simple.

Tools are useful, tools are important. If CQRS/ES wants to make it into mainstream it needs to think about tooling. So far I have not been impressed with the people in the community hand waving about this and not having much to show for it.

Re:Building a CQRS/ES web application in Elixir using Phoenix by slashdotdash on Friday January 06, 2017 @06:38PM (#13341335)
> If CQRS/ES wants to make it into mainstream it needs to think about tooling.

I agree with this entirely. CQRS/ES applications really help from tailored tooling. Tracking chains of events using correlation and causation identifiers. Auditing commands. Projecting events out to datastores like Elasticsearch. Then using Kibana[1] to create dashboards to drill down into the data. I'd like to go into this in more detail in the future. Revisit this case study after 6-12 months and describe the pitfalls, and countermeasures. Identify tools that allow you to monitor the system proactively.

[1] https://www.elastic.co/products/kibana

Re:Building a CQRS/ES web application in Elixir using Phoenix by jgeraert on Saturday January 07, 2017 @05:06AM (#13343286)
> One thing that absolutely needs library/drivers is persistence of the event store. I say this having built my own as well as contributing to open source ones in the past. It is still a hard and not well solved problem to do this well. Again it can be simple, but in the real world it isn't usually that simple.

Would it also be such a hard thing to do if you can delegate the actual persistence to something like a rdbms? What are the typical pitfalls?

Re:Building a CQRS/ES web application in Elixir using Phoenix by dm3 on Saturday January 07, 2017 @09:31AM (#13344285)
Having built a few RDBMS-based event stores - it's pretty easy to do. There are two parts that I can think of that are not completely trivial - appending events to the stream while respecting "expected version" modifiers with optimal concurrency and allowing for fast and light subscriptions to new events (e.g. LISTEN/NOTIFY in Postgres, ringbuffer on the client).

The good thing is that you can adapt the event store to your performance requirements and do the simplest thing possible in a huge amount of cases.

Re:Building a CQRS/ES web application in Elixir using Phoenix by slashdotdash on Friday January 06, 2017 @05:36PM (#13340946)
I'm the original author. Any application built following the CQRS/ES pattern requires development of the same building blocks: command registration and dispatch; hosting and delegation to aggregate roots; event handling; long running process managers.

I built Commanded as a self-contained, reusable, open-source library. With the goal of demonstrating one approach to implementing the pattern using Elixir. I hope it provides some use. That's why I've written up the case study. Anyone can take the code as is, to bootstrap their own application. Use it as a learning tool, take away the good ideas. Rebuild and improve upon the bad.

I received a pull request only today adding support for Greg Young's event store. That's going to broaden the appeal.