We handle communication over a SerialPort. We have a SerialPortWrapper class that handles the traffic over the ports. We then have an SDPPort class, which provides a very elementary unfinished GUI for port monitorring and at the very end, we have a basic RobotPort. This has 3 methods:
Your particular robot will probably have more commands. That is where interfaces come in. Fred implemented two additional interfaces. The FourWheelHolonomicRobotPort and the PropellerEquippedRobotPort. The reason for this cumbersome way of implementing commands is that this way other classes can use the ports and type cast them to the interface class. This is why your robot could reuse our 4 wheel holonomic drive and port interface WITHOUT actually being an instance of Fred and still be navigable by the navigation system.
This is the structure: