Code Behind in the Class Library RRS feed

  • Question

  • I was wondering what people thought of the following:


    We have web application which we have sold to numerous clients each of them adding their own bespoke functionality with the core of the product remaining unchanged. The problem we faced was that when we discovered bugs in the code behind page it as a pain to then go into each of the clients versions and do the same update, ideally we would like to do the fix in the base product and then have this propogated through all the other versions on a rebuild.


    Our proposed solution to this would be to have all the code behind pages stored in the class library (which all the client versions inherit/use) that way when a fix is made in here it will automatically be picked up by the client versions.


    Does anyone know of any other way to achieve the same result?

    Monday, January 21, 2008 2:59 PM

All replies

  • Gazeth,


    I think the question is, are the companies adding their own functionality to the existing application in an official capacity?  The other question is, how much of the code needs to be customisable, and if it is a small and finite number of functional areas, can you easily define an interface for them?


    You could then perhaps move the code into a plugin-able architecture. 


    If there are specific areas of override within the application you could use a strategy / provider pattern so that the clients can create their own provider, add a reference to a configuration file, and away they go.  You could even write utilities to test the functionality of the providers if you wanted to, to make life easier for your clients, or better stil offer to do the work for them properly, and charge for it, should that be possible?!


    The difficulty might be if the code that the client have written is significant, then that might be quite a lot of work that you would have to do.  However, I suspect that even putting code into a library that must be referenced and used would also mean decoupling a lot of the client code already anyway, or dealing with a whole lot of bugs.


    As I'm writing this, I'm looking at your question, and now thinking that maybe you have all your code in the code behind files?  A nice exercise would also be to use an MVP pattern to move that logic to be called from the presenter, then you can more easily replace parts of the architecture without them being coupled by the fact that they're all in the code behind.  You'll find that you can put some unit tests around all the code, which will make it cleaner, decoupled and so on, and then this question will really not need to be asked.


    If you need more guidance with that process, please ask further questions.


    I hope that helps you,


    Kind Regards,



    Martin Platt.

    Tuesday, January 22, 2008 5:03 AM