GithubHelp home page GithubHelp logo

fedyapetrenko / cqrs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tpierrain/cqrs

0.0 1.0 0.0 4.27 MB

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

C# 71.15% HTML 27.05% JavaScript 0.38% CSS 1.42%

cqrs's Introduction

BookARoom

BookARoom is a simple project to explain CQRS during a live coding session at MS experiences'16 (slides are available here: https://github.com/tpierrain/CQRS-slides) or here on slideshare

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.


Highlights of the talk

  1. CQRS (WITHOUT Event Sourcing):

    • Why CQRS?
    • Pattern origin
    • How read and write models articulate
    • Eventual consistency challenges and options
    • 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: containing the reusable infrastructure code (i.e. non-domain one like adapters, command handler, repositories) for both read and write models. (depends on both Domain and IntegrationModel projects)

  • directory BookARoom.Infra.Web: ASP.NET core project hosting the web infrastructure code (like ViewModels, Views and Controllers) which relies on the BookARoom.Infra code. (depends on both Domain, Infra and IntegrationModel projects)

  • 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

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


lab

The objective of this lab is to add the "cancel a reservation" feature.

Step by step Instructions (following outside-in TDD technique) are presented here.


Tracks of improvement

  1. 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.

...

cqrs's People

Contributors

tpierrain avatar mendelmonteiro avatar

Watchers

James Cloos avatar

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.