Friday, July 26, 2013

Assembly Shadowing

I've written a piece of software that bolts onto another piece of software.  It does something really cool, but that's not relevant to this post.  What is relevant is that my bolt-on needs to reference assemblies in the other software, including third-party assemblies.  My bolt-on may be deployed in environments with various versions of assemblies in various configurations.  It turns out that it can be very difficult for me to get access to those assemblies to test and compile with--usually for licensing reasons.

To solve this, I created something I am calling "shadow assemblies".  These are skeleton assemblies with only the classes and methods that I am actually using, but they use reflection to reach out and manipulate the real assemblies at run time.  My code can treat the shadow assembly exactly the way it used to treat the real assembly, but I don't need to worry about different versions of the real assemblies as long as the differences are irrelevant to the functionality I am using.

I feel like there ought to be some interesting ways to push the envelope on this.  For example, your shadow assembly could be running on one machine, interacting with the real assembly on another machine via some kind of protocol.  Or you could swap out the real assembly with an output generator that would feed all kinds of data back to your system for simulation and testing purposes.

No comments:

Post a Comment