Logbook 7

Thomas PIERRAIN edited this page Sep 21, 2016 · 29 revisions

Day 20 (May 9th 2016)

A Logbook entry written by @tpierrain

My refactoring journey towards Hexagonal Architecture

After few debates on twitter and a blog post to clarify why Hexagonal Architecture != Layers (in my opinion), I decided to show an example of code to the community in order to continue the discussion. Since I'm not allowed to push some code outside my company, I started to reawaken the #SORLunchBox pet project to make it hexagonal.

I took me few days (of delay) since I could only work on it during the transports (metro, train,...) and few early mornings. The most important task for me those days was to externalize our Market naive implementation from the Domain (because of the previous YAGNI) to another third party infrastructure project.

To help you to grasp what the Smart Routing System (SOR) is and how its Hexagonal Architecture articulates for it, I also draw some sketches.

And before someone is telling me:


I'd like to add few...


  • The #SORlunchbox project is quite young and immature implementation (it's just a beginning). As of today:

  • It support 1 financial instrument only (implicit within the code ;-(

  • Even if it's event driven, the code is synchronous today ;-( This is because we are still on the Journey 1. The goal of this pet project is to compare various reactive programming approaches in a second step (see Journey2)

  • There are many missing opportunities to use proper 'DDD' Value types (i.e. to replace all the decimal prices (primitive obsession) with an Amount Value type embedding the currency for instance)

  • ...

  • Watch only the CSharp code since the FSharp version is even younger

The code

Ok. That being said, we can now have a look at the code. To focus on the hexagonal architecture specificity, I recommend you to start by watching:


Hope this will clarify what Hexagonal Architecture is and how it articulates.