Clutch
Clutch

Reputation: 7620

DDD component for accessing infrastructure hardware

I'm new to DDD and I'm trying to decide how to access infrastructure hardware (network devices, specialized hardware, etc) information. Most of the devices I want to communicate with and control have a state. I'm representing the devices in the domain as objects but to replicate the state should it be through a repository or a service or some other component.

An example would be: If a customer buys a firewall the command AddFireWall would be executed and the vlan on a network device would be switch to a firewall and an IP and private IP would be placed on that firewall device. I'm representing the network devices and firewall devices as entity objects in my domain. The state of those objects/devices would be saved in the repository.

Upvotes: 0

Views: 361

Answers (1)

Codescribler
Codescribler

Reputation: 2305

Generally speaking you domain models should be kept free from external dependencies like hardware and networks etc. There is a concept known as an Anti Corruption Layer that may be worth looking up. The idea is to build a bridge between systems like hardware and the domain. It's responsibility is to translate between the two systems. If hardware or network changes then all you need to adjust is the code in the ACL.

Other approaches could include generating event messages from the hardware. These messages can then be subscribed to be various parts of your system.

Upvotes: 1

Related Questions