Friday, June 6, 2014

Command Pattern

Requester -> Command invoker -> Receiver

I have this pattern implemented right now. We have a product that is complied against a specific dll version, then it must be deployed with that. Every time the interface changes in the dll you have to remove the reference, unregister the DLL from COM, and then register the new one. It makes development and deployment unnecessarily difficult.

Instead of putting up with that crap for long we implemented the Command Pattern without knowing it was called that!

Product -> command invoker dll -> receiver dll that does the work

This allows us to develop much painlessly because changes to the interface are not visible to the product since it's going through the command invoker.

The command invoker uses assembly reflection in .net. The requester needs to pass in the method name + params. 

Right now we also have a job scheduler, but it's not decoupled from the job executing objects. Now that I learned about this pattern I can solve this problem :)

No comments:

Post a Comment