MendelMonteiro / CQRS

A simple project to explain CQRS during a live coding session at MS experiences'16

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BookARoom

BookARoom is a simple project to explain CQRS during a live coding session at MS experiences'16

The project is a dotnet core ASP.NET web site (in order to be containerized in the next session), allowing users:

  1. To consult and search for available rooms (READ model)
  2. To book a room (WRITE model)

Of course, booking a room (write model) will impact the read model accordingly.


disclaimer

This project is not a real one nor a prod-ready code. The intent here is to illustrate the CQRS pattern during a 40 minutes session. Thus, some trade-offs have been taken in that direction (e.g. the usage of Command and Queries terminology instead of domain specific names that I would have used otherwise).

CQRS without Event Sourcing?!?

Yes, since the timing will be short for this MS experiences'16 session in Paris (no more than 30 minutes of live-coding), I've decided to focus only on CQRS pattern, WITHOUT Event Sourcing (ES). Indeed, ES is often a mental dam for people's understanding. I also find important that people understand that CQRS loves Event sourcing, but CQRS != Event sourcing.


Remaining tasks before the D-day

  1. Plug the ASP.NET web app
  2. Fight against the current anemic model (mainly because I never worked on that topic and that I don't have any expert available to help me ;-( and embrace more the ubiquitous language of this domain.
  3. Identify which use case(s) will be usefull to live-code at MS event (to zoom on CQRS) and to find the best pedagogical workflow for it.

Highlights of the talk

  1. CQRS (WITHOUT Event Sourcing):
    • why CQRS?
    • Pattern origin
    • How read and write models articulate
    • Eventual consistency
    • Short clarification between CQRS & Event sourcing
  2. How Outside-in TDD works
  3. How Hexagonal Architecture can help us to focus on Domain first, before tackling the infra code (ASP.NET) in a second time
  4. What is dotnet core and how it articulates with the new version of ASP.NET

Projects & Dependencies

  • directory BookARoom.Domain: containing all the domain logic of the solution (for both read and write models). (has no dependency)

  • directory BookARoom.Infra: ASP.NET core project hosting the infrastructure code (i.e. non-domain one like adapters) for both read and write models. (depends on both Domain and IntegrationModel projects and is also an ASP.NET dotnet core project)

  • directory BookARoom.Tests: containing tests for all projects. (depends on all the other BookARoom projects)

  • directory BookARoom.IntegrationModel: command-line project to generate integration json files for hotel (from code). (has no dependency)


Tips and tricks

How to run the tests

Note: resharper and ncrunch don't support yet dotnet core; you can only run them via Visual Studio test runner (e.g. Ctrl-R, A) or by executing:

 dotnet test 

within the BookARoom.Tests project directory.


CQRS in a nutshell

There are many forms of CQRS implementation. The implementation of the BookARoom project follows this version:

directory

source: https://msdn.microsoft.com/en-us/library/jj591573.aspx

...

About

A simple project to explain CQRS during a live coding session at MS experiences'16


Languages

Language:C# 87.7%Language:HTML 12.3%