Status Updates From Domain-Driven Rails
Domain-Driven Rails by
Status Updates Showing 1-30 of 59
Jean Tessier
is on page 157 of 170
272 - Glancing at Eventide. Repeats some of the patterns seen earlier with rails_event_source. Not clear what event mechanism is used in Eventide.
— Dec 31, 2021 03:18PM
Add a comment
Jean Tessier
is on page 157 of 170
255 - Failure modes for inter-process notifications. Direct calls (grapeater), external queue (Kafka), and/or internal queue (rails_event_store) for transactionality + external queue for broadcasting. Bunny, a Ruby RabbitMQ Client on GitHub.
— Dec 31, 2021 01:39PM
Add a comment
Jean Tessier
is on page 157 of 170
250 - The author calls ancillary work "side-effects". Functional programming drills into us to avoid side effects, so this double meaning is a little unfortunate.
— Dec 31, 2021 01:28PM
Add a comment
Jean Tessier
is on page 157 of 170
240 - Automatic failover when error rates exceed threshold. Splitting up complex UIs. The author shows their inexperience, which hurts their credibility. The part on splitting up UIs has nothing to do with anything else in the book!
— Dec 31, 2021 01:17PM
Add a comment
Jean Tessier
is on page 157 of 170
231 - Separating module using a gem structure (also references Shagemann). Has tips for autoreloading and putting the specs alongside the code in the module structure.
— Dec 31, 2021 12:36PM
Add a comment
Jean Tessier
is on page 157 of 170
226 - Modularization using gems or Rails engines. Mentions CBRA by Shagemann. Naive opinion that you can easily migrate between engines, microservices, and serverless.
— Dec 30, 2021 08:16PM
Add a comment
Jean Tessier
is on page 157 of 170
223 - CQRS creates two representations of a piece of data instead of just one. One is optimized for writes and the other is optimized for reads. Infrastructure (the event stream) keeps them (eventually) in sync. Mentions a 2010 post by Greg Young that I cannot find.
— Dec 30, 2021 08:08PM
Add a comment
Jean Tessier
is on page 157 of 170
The author bailed out on trying to cover versioning of events over the lifetime of a stream.
— Dec 30, 2021 05:46PM
Add a comment
Jean Tessier
is on page 157 of 170
215 - A long example using EventStoreDB and reading back events through its paged REST interface over HTTP. It supports projections so it can materialize views based on the event stream(s).
— Dec 30, 2021 05:44PM
Add a comment
Jean Tessier
is on page 157 of 170
They use RubyEventStore::Client#append with an explicit expected_version to do optimistic locking. This way, they can change state from "almost published" events but still fail to publish them in case of a collision. This is why they need to rehydrate objects each and every time.
— Dec 30, 2021 04:34PM
Add a comment
Jean Tessier
is on page 157 of 170
I like that they picked an example app with lots of real life complexity but can be simplified enough for the examples without losing the flavor. Author has worked a lot with ticketing apps.
— Dec 30, 2021 04:21PM
Add a comment
Jean Tessier
is on page 157 of 170
Still struggling with changing state before or after publishing effects. I like the way I did it with Kafka where a commands only published events and the state only changed in response to published events from the stream.
— Dec 30, 2021 04:13PM
Add a comment
Jean Tessier
is on page 157 of 170
185 - Testing can either use events to setup fixtures, it call" commands" directly. You check the expected state and "unpublished events" in one set of tests. You check that events are being published in a separate set of tests.
— Dec 30, 2021 04:10PM
Add a comment
Jean Tessier
is on page 157 of 170
174 - Their version of event sourcing rehydrates objects of every load(), instead of keeping them in memory.
— Dec 30, 2021 03:54PM
Add a comment
Jean Tessier
is on page 157 of 170
On page 155, the author discusses how he liked the diagrams in some of the other publications he references. And yet, he has very few in this book. The code samples are nice and short, but a good diagram can do wonders to establish the context.
— Dec 29, 2021 08:42PM
Add a comment
Jean Tessier
is on page 157 of 170
Process managers are like Saga with orchestrator. The bit about testing permutations using Ruby's #permutation and #repeated_permutation was a really nice touch. According to some, process manager coordinates an action across bounded domains, whereas saga is more for long duration processes. There is a process manager in Enterprise Integration Patterns.
— Dec 29, 2021 05:57PM
Add a comment
Jean Tessier
is on page 141 of 170
CQS: queries are immutable and return values, commands are mutations and return nil. Too inconvenient for many libraries (e.g., iterators). Reminds me of GraphQL. CQRS: separate stores for reads and writes. Read stores are denormalized, rehydratable. Replaces multi-table queries. Write side preserves biz rules. Read side cannot reject a change; it cannot decide. (p. 137)
— Dec 28, 2021 11:21PM
Add a comment
Jean Tessier
is on page 125 of 170
Using events instead of AR callbacks. Difficulties in keeping things in sync in the face of tx rollbacks. Just like at Gusto! "Update other Aggregates using eventual consistency" (p.124) Skittish about using microservices out the gate. Example uses rails_event_store.
— Dec 28, 2021 10:54PM
Add a comment
Jean Tessier
is on page 100 of 170
Domain Events record things that have happened, including failures. They can have multiple handlers and these can be asynchronous. A single action (i.e., command) can lead to multiple domain events. An event can be part of multiple streams, so we can group them according to different dimensions (in week X, about record Y, of type Z).
— Dec 27, 2021 05:53PM
Add a comment
Jean Tessier
is on page 83 of 170
https://rubygems.org/gems/arkency-com... has 800K downloads.
https://github.com/arkency/command_bus has 48 stars.
— Dec 27, 2021 05:02PM
Add a comment
https://github.com/arkency/command_bus has 48 stars.
Jean Tessier
is on page 83 of 170
Command Bus is a synchronous registry of handlers for different Command objects. Commands group together a bunch of related params and can use ActiveModel to do simple validation. There is at most one handler per command, so we can have a clear success/failure indication. If the handler is asynchronous, then "success" means "it was scheduled" and the real success status has to come from somewhere else, somehow.
— Dec 27, 2021 05:00PM
Add a comment
Jean Tessier
is on page 69 of 170
Application services orchestrate logic in the application, moving data around and coordinating side-effects. Commands are useful to group pieces of data together. Domain services implement domain-specific logic.
— Dec 25, 2021 03:19PM
Add a comment
Jean Tessier
is on page 51 of 170
Aggregates are groups that change together and are persisted together. If the group is too large, it can create contention in the DB with large and/or long transactions. If the group is too small, you need to rely more on eventual consistency and undoing something is more involved. Always operate on the aggregate through its root, to validate rules. Aggregates refer to other aggregates by ID only, no Rails assoc.
— Dec 19, 2021 10:35PM
Add a comment
Jean Tessier
is on page 41 of 170
Bounded contexts vs domain models. Value objects vs entities. Rails makes it very easy to build a big ball of mud. ActiveRecord exposes the details of the database mapping to everyone, making it difficult to refactor unless you have comprehensive knowledge of the application.
— Dec 19, 2021 09:58PM
Add a comment


