I'm looking for design advice for a domain model scenario I have.
Let's say I have have a squad of Robots, each controllable via a wireless network connection.
I have an IRobot domain object that represents a real-world robot. The interface looks like so:
public interface IRobot
{
void MoveHeadUp(int toAngle);
void MoveHeadDown(int toAngle);
int GetHeadAngle();
}
Example scenario: A virtual robot is shown in a GUI. In offline mode, the GUI shows what would happen if we tell the domain object (IRobot) to raise its head 5 degrees.
In online mode, the GUI would show the robot move AND the command would be sent to the physical robot and it would move as well.
I'm trying to add remote capabilities around this domain object, ie. getting/setting remote state via Ethernet or serial, etc. I don't want to pollute the domain object with network connectivity issues.
What is the best approach to implement IRobot domain behaviour and keep remote connection implementation details separate?
Aucun commentaire:
Enregistrer un commentaire