stex2-blog

Organising for Architecture

2021-07-29 / exchange,server,python / Sam

Since my last update I had added the concept of a Client (user) which worked similarly to Stocks (make a list of them and stuff it into the Exchange), and wanted to see how access to the Clients and Stocks could be provided by a Repository (before attacking anything more complex like the OrderBook). Before that, I had to pull apart my single script and set a layout to help organise the real ARCHITECTURE that was about to happen. I settled on the following top-level modules:

The most interesting thing about this exercise was that I quite quickly realised the Exchange domain entity was in fact a service layer. The Exchange offers exchange-related functionality to the main.py application entrypoint. If nothing else, merely thinking about what a cleaner architecture looks like in your project tree will encourage better domain abstractions and make the responsibilities of intra-application services more obvious.