Skip to content
MendelMonteiro edited this page Nov 1, 2014 · 19 revisions

Day 16 (October 29th 2014)

A Logbook entry written by @mendelmonteiro

Thomas, Tomasz and I were present for this session.

#More hexagonal discussions

We started the session with the objective of getting our test harness to actually test something a little more realistic (i.e. where we could interact not only with the investor but also with the markets). We took a little detour when we came back to talking about the meaning and responsibilities of a port/adapter. We finally agreed that the port part handles all the transport related functionality whilst the adapter part handles the conversion to the DTOs expected by the interfaces exposed by the domain.

We also hashed out exactly where we were going to box off the SOR in terms of what would be re-implemented in each of our target languages/frameworks/patterns (i.e. F#, Michonne, Disruptor, etc...). We agreed that we wanted to include all of the inner domain hexaqon in the interchangeble part which means the implementations would directly expose or consume the interfaces which bound the domain.

#Let's push things forward

My fingers were getting a little itchy by this stage so I proposed that we keep our momentum up by advancing on the market facing interfaces.

First off we got a little refactoring out of the way so as to match what we had drawn up on the whiteboard in the previous session. The ISmartOrderRoutingService became ISmartOrderRoutingRawInprocPort (it's a port/adapter even if the 'transport layer' is just method calls. Also, ISmartOrderRouting became ISmartOrderRoutingEntryPoint.

Next up we decided to have a look at the SOR and Solver to see what they were going to need from the Market facing interfaces. We decided to make these interfaces as granular as possible and chose a first person naming convention for them (this was Tomazs' suggestion which I quite liked and wanted to see how the code read - though I admit the first impression left me expecting to see a photo of a cat on the next page).

The responsibilities got condensed down into the following interfaces:

  • List of markets - IProvideMarkets
  • Market data for an instrument - ICanReceiveMarketData
  • Placing an order on a market - ICanRouteOrders

#Furious coding

As we started changing the unit tests to inject these interfaces into the SOR and then start using them in the SOR we realised that the changes were going to be fairly significant and that we were going to be hard pressed to finish them in the 45 minutes that remained. We kept the interfaces as clean and as granular as possible whilst being as expedient/naive as possible in their implementations.

There's a bit of refactoring still left to be done especially around the IMarket interface and Market class. We left a bit of duplication/confusion between the IMarket and Market (Market doesn't implement IMarket for starters). Basically IMarket is an external artifact whereas Market is internal to the SOR.

As we started consuming the market data interface in the solver we realised that we needed a buffer between the market data feeds for a selection of markets and the Solver. We implemented this as the MarketSnapshotProvider.

Ding-dong! End of the session :-(

The project is building and most of the tests are passing - it would have been great to have another 15 minutes or so to tie up a few loose ends but it will have to wait for next time.

This will be my last contribution to the on-site sessions but hopefully it won't be too long before there's a stable API up that I can use to implement my version of the SOR :)

Clone this wiki locally