Skip to content
Thomas PIERRAIN edited this page May 10, 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 thing was to move out our Market naive implementation into another project.

To help you to grasp what the SOR is and how its Hexagonal Architecture articulates I also draw some sketches to present what the SOR is (25,000 feet) and to present the hexagonal architecture / the projects.

Before someone is telling me: xkcd

I'd like to add few...

Disclaimers:

  • 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 mainly synchronous ;-(next step will be to make it reactive and thus asynchronous)

  • 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

Ok. That being said, we can now having a look at the code. I strongly recommend you to start by watching the SorAcceptanceTests

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

Clone this wiki locally