I am working on a project and I am trying to utilize the concepts of Domain Driven Design.
I have the following domain model: (it is simplified for this question)
Let me explain the system first.
This system is for monitoring data coming from gateways. In this case there are two gateways, but there might be more in reality. Each gateway has its own implementation, so its own entities.
An example of the system is as follows:
A company has a project to monitor ship data.
So they have two gateways. A gateway with type Field-Device-Gateway and a gateway with type HTTP-Client-Gateway.
The first gateway (field-device-gateway) can have multiple field devices. A field device is a small device onboard on a ship. This device receives all data coming from devices on board of the ship. This is through a source (like an address) that has to be setup in the system.
The second gateway (http-client-gateway) can have multiple HTTP clients. Each client may have multiple routes.
So, a gateway also has variables. A variable is a configuration for getting a specific set of data. So, on the field-device-gateway might be a variable specifying to get integer data from a specific device, from a specific field device source, from a specific field device.
The system will make a request to the field device with the new variables. The field device then knows what data to send. It will be received by the system and stored in the database.
So, what am I asking?
Currently, everything is coupled. I need to define boundaries and then aggregates, but I just don't know where to start.
If I would not create boundaries, this will just become an enormous coupled mess and makes it hard to make aggregates.
So, what would the boundaries be? And what about the aggregates, are there even aggregates? Is everything its own aggregate?
And if everything is its own aggregate, how do I enforce some business logic like: A variable can only exist if there is a gateway, project and company.
