mardi 21 février 2017

Proxy Design Pattern for an Interface and a Concrete implementation

I want to use the League\Event package within my architecture to control the events within my system where requests and responses are handled through the HttpKernel interface implementation from Symfony.

Symfony, though, uses its own event system and this means that either I have to re-implement my own HttpKernelInterface and I actually do not want to go that route.

Let us imagine the UML diagram below:

enter image description here

Object Oriented design advocates that we must always program to interfaces hence the EventInterface within my own code-base to inverse the dependency of these two event systems. However, in my mind I am treating my EventInterface as a Proxy where I can be able to turn any standard object into an eventful one just by implementing this interface enforcing any rules upon that object.

Also the idea is to create objects that are able to trigger their own events which I think that is something both libraries do not offer.

Furthermore, the idea would be to resolve my event triggers out of the container based on a certain trigger to know whether an event is of symfony type or league meaning I wouldn't really need to worry about such technicalities.

Does my context permit me to really use the Proxy Design Pattern or I should integrate these two differing interfaces differently?

Aucun commentaire:

Enregistrer un commentaire