mercredi 23 août 2017

OO Design - Entity class depends on Core class

I have a class called VStateManager in Entity. In my Core I have a class called VFactory. There is a one to one mapping between VState (which is on object created by VStateManager) and V (an object created by VFactory)

The class VFactory implements the following interface

public interface ISensorUpdate
{
        void StartVSensors(VId Id, VType Type, IVSensorHandlers Handlers);
        void StopVSensors(VId Id);
}

The creation of VState object by class VStateManager is driven by a Network event. However when the VState object is created the corresponding V object should be created by VFactory However as I mentioned VStateManager is a part of Entity and VFactory is a part of Core.

VStateManager cannot depend on VFactory directly. What is a good design to get around this problem.

Aucun commentaire:

Enregistrer un commentaire