• Stars
    star
    143
  • Rank 255,913 (Top 6 %)
  • Language
    C#
  • Created about 8 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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.

...

More Repositories

1

NFluent

Smooth your .NET TDD experience with NFluent! NFluent is an ergonomic assertion library which aims to fluent your .NET TDD experience (based on simple Check.That() assertion statements). NFluent aims your tests to be fluent to write (with a super-duper-happy 'dot' auto-completion experience), fluent to read (i.e. as close as possible to plain English expression), but also fluent to troubleshoot, in a less-error-prone way comparing to the classical .NET test frameworks. NFluent is also directly inspired by the awesome Java FEST Fluent assertion/reflection library (http://fest.easytesting.org/)
C#
309
star
2

hexagonalThis

A simple kata to live-code with Alistair about Hexagonal Architecture
C#
124
star
3

Value

a pico library (or code snippets shed) to help you to easily implement Value Types in your C# projects without making errors nor polluting your domain logic with boiler-plate code.
C#
86
star
4

Diverse

Diverse, the Fuzzer pico library you need to make your .NET tests more Diverse
C#
34
star
5

me-myself-and-i

A repository to list all my public interventions (talks, live coding sessions, etc)
17
star
6

SmokeMe

A convention-based dotnet plugin that will automatically expose all your declared smoke tests behind a /smoke resource in your API.
C#
16
star
7

liveCoding-HexagonalFromScratch

Live coding session to illustrate the usage of Hexagonal Architecture
C#
6
star
8

logging-guidelines

4
star
9

talk-outside-in-diamond-tdd

The slides of Thomas' talk about outside-in diamond tdd style
3
star
10

wiked

wiked! is a markdown-based web site template to start all your pragmatic (and DRY) project KM with
3
star
11

kata-office-carpaccio

Instructions for the Elephant Carpaccio kata (Thomas' version, inspired by the Office tv series)
3
star
12

personal-writings

A place to share some documents, writings
3
star
13

CQRS-slides

slides for MS experiences'16 event
3
star
14

outside-in-hexagonal

A greenfield code kata to show how to build a system following the outside-in TDD approach and relying on the hexagonal architecture
C#
3
star
15

NFluent-Web

(alpha) NFluent.Web is an extension library to NFluent for web-related tests. NFluent is an ergonomic assertion library which aims to fluent your .NET TDD experience (based on simple Check.That() assertion statements). NFluent aims your tests to be fluent to write (with an happy 'dot' auto completion experience), fluent to read (i.e. as close as possible to plain English expression), but also fluent to troubleshoot, in a less-error-prone way comparing to the classical .NET test frameworks. NFluent is also directly inspired by the awesome Java FEST Fluent assertion/reflection library (http://fest.easytesting.org/)
C#
3
star
16

kata-tic-tac-toe

Tic-tac-toe kata
C#
2
star
17

kata-GildedRose

(kata) Gilded Rose
C#
2
star
18

Tmp

C#
2
star
19

talk-beyond-hexagonal-architecture

Slides for our talk: Beyond Hexagonal Architecture
2
star
20

talk-hexagonal-and-beyond

For an upcoming session
2
star
21

MarsRovers

(kata) Code kata described here: http://www.techinterviewpuzzles.com/2010/09/mars-rovers-thoughtworks-puzzles.html
C#
1
star
22

Slides

A repository for all the slides and keynote supports.
1
star
23

writings

A repo with some of our writings about software
1
star
24

karaoke-powerpoint

Decks for Power point karaoke sessions
1
star
25

SmokeMe.TestAdapter

Test runner and adapter to transform your SmokeMe! smoke tests into integration tests.
C#
1
star