Giter Club home page Giter Club logo

candid-cqrs's Introduction

candid-cqrs

A simple an accessible CQS/CQRS set of libraries.

Build Status

Goals :

  1. Illustrate the CQS/CQRS usages in a simple and clear manner, even for the beginner
  2. Provide a "ready to use" seed that people can use as it is or really easily modify for their own usage
  3. Show how CQRS can allow for total framework independence. AKA : Moving you domain logic from Spring to dropwizard IS simple.
  4. Illustrate and insist on the fact that different flavors of CQS/CQRS exist. AKA: You probably do not need event sourcing right now and even a really simple CQS split will greatly help you in your unit testing. (Refer to the link provided for more infos on that).

Rationale :

During my research on the subject, I could not find a simple enough Java example that would help me fully understand the CQS/CQRS concepts. Not many implementation exist or, really often, they take a highly generalized, highly functional and/or straight to event sourcing approach. My experience is that those are terrible to read for the beginner and confuse more than illustrate the underlying concepts.

Guiding principles:

  1. No hidden magic, no weird annotations, no over-engineered generic abstract classes, no dark voodoo.
  2. "Repetition is better than the wrong abstraction" - Sandi Metz.
  3. "Get simple or die trying" - 50 cents, the untold quotes.
  4. "You use libraries. But frameworks use you"
  5. There might be better ways to do it. Still, nobody will be fired for doing it this way.

What do I have to gain?

  • Say goodbye to service layers and lasagna code
  • An external world proof code base
  • Finally! freedom on the read side, a word without the ************ of Mappers (You might never come back)
  • Testability by use case
  • Amazing decoupling
  • Better traceability of what happens on your system
  • Easy handling of specifications change, especially when it come to side effects

What are the trade offs?

More classes really, but they should be way simpler to deal with

That's is cute but is it reliable/fast/worth the pain?

I use this architecture in production, not on a "let's code twitter in 30 seconds" toy project but in a payroll app people rely on to receive their money. They are pretty unforgiving audience and did not complain so far. Once understood, I find this type of architecture to be a delight to work with and to offer a flexibility I was herdly finding in my projects previously.

Do not to take my word on it. Take it for a spin.

How to start

If you are a newbie (Some of this stuff is in progress):

  1. Looks at the linked presentations / slides.
  2. Checkout the cqrs-api project. As an exercise, add unit tests and a decorator for each of the command/query buses. That should give you an idea of what happens.
  3. Looks at the happy-neighbourhood domain code.
  4. Look at the various frameworks integrations (only Spring is available so far).
  5. Add your own spices to it.

Sources of inspiration :

Those great presentations :

https://speakerdeck.com/lilobase/ddd-and-cqrs-php-tour-2018

https://www.slideshare.net/rosstuck/command-bus-to-awesome-town

https://speakerdeck.com/lilobase/cqrs-fonctionnel-event-sourcing-and-domain-driven-design-breizhcamp-2017

Alistair in the hexagone: https://www.youtube.com/watch?v=th4AgBcrEHA

Models & Service Layers; Hemoglobin & Hobgoblins: https://www.youtube.com/watch?v=ajhqScWECMo

Recommended reads

To be done but in the meantime

  • hexagonal architecture
  • Implementing Domain Driven Design

More to come...

Final word

If you are a beginner, you should definitely stay away from frameworks. Don't even get me started on Lagom.

candid-cqrs's People

Contributors

barsifedron avatar eskatos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

candid-cqrs's Issues

Domain and ManyToMany relationships

another question please how to implement a many to many relation without polluting the domain with the hibernate annotation
for OneToMany relationships you make lists
but what about ManyToMany relationships

How to implement jwt authentication inside the command and query buses ?

hello Mr already a big thank you for the work you have done, but it hurts you Mr, I will use an authentication decorator for my several limited contexts how this decorator is implemented. Arnaud Lemaire talks about this conference ddd-and-cqrs-php-tour-2018.
Thank you for your help I am starting with the cqrs ddd event sourcing on an Insurance project

communication between bounded context

Hello Sir barsifedron,
really thank you for sharing experience with CQRS, but here I have a problem how to implement the events (C / S) between different bounded context.
for example for your platform with two bounded context
with different databases

1 loan (the item is loaned) loan:aggregationId
2 popular items (the most loaned items of the day)loanPopular:aggregationId

help me and thank you

Allow some domain events to be processed within the current transaction and others to be processed after

One domain event might trigger many event handlers (ie: one handler creates
activity logs and the other sends emails or updates a counter). If handler1
and handler2 both listen to the same event, we might want handler1 to run
within the SAME jpa transaction as the caller (default behavior) but we might
also want handler2 to wait for the current transaction to be committed before
running (failure to send an email should not usually roll back successful
changes for example).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.