Working with a few code generation toolkits recently has sparked some thoughts on how the usage of code generation impacts the client that might purchase the software.  In the specific use case of an ISV writing software and then selling the IP to a customer there is a potential for future issues if code generation was used.

Code generation is normally used to cut down on the repititious code that follows certain patterns.  Stored procedures, data access layers and in some cases CRUD style forms/webforms are perfect examples where the code required can be inferred by database structures or other methods.  There are many examples of toolkits available on the internet such as CodeSmith, LINQ to SQL and CSLA.NET.  I can’t remember the last time I’ve written database access code and I don’t see why you should be doing this work yourself.

In the case of purchased/freely available toolkits, you can, on the sale of the software, package the template you used to generate the code with the software itself.  However, in the case of code generation where the tool used is not freely available, this puts the client in a bind for future releases if the ISV is not contracted for the work or the ISV is not available to provide the neccessary resources.  One could say that the client could simply copy the patterns in the generated code but in reality this will be time consuming and wasted time and effort.

Do you think that ISV’s should bundle their code generation tools with the source code as a matter of course?  Its an interesting topic and interesting implications for both ISVs and their clients.