Code Generation – It’s worth to think about it…


I have been doing auto code generation for .net application for many years now, and it seems that i have almost saved 35% of time or may be even more because of adopting to this technique.

Its not BIGGY to see how to do it. Following are ways we can think of:

  1. Writing our own code generator
  2. Using some other tool like CodeSmith (have to pay for it)
  3. OR Use MyGenerationSoftware’s Free tool – with ability to script the interface and as well as meta deta for database already built in.

I have concentrated on point 1 &  3 in most of my career and found both worthy of adopting. Ofsource first one take more time than later one. Now, coming to our big point HOW THAT CAN HELP ME???

To answer this let’s work out a little generic – pseudo – template example here:

class Person

int FirstName;

int LastName; 

 Person(firstName, lastName){

FirstName = firstName; :LastName = lastName; 



end class

Now, the above little seems to be simple – but often its not the case that we have just 2 propeties to work out so there can be 20 of them. You can imagine where we are going on this.

Now auto code generation could help do the following:

  1. Maintain Coding Guidlines (cases, varaible names etc …)
  2. Confidence of being right – no testing needed for each object.
  3. basic implementation (insert, delete & update or even concurrency handling)

So, this kind of effort allows us to actually same time in our development and gives us confidence that generated code will be working all the time and we will be taking benefit from it.

Think of $$$ a company can save by using this technique…

by the way you can download free tool from

they also have there already buil template as well. So, enjoy code generation and save lots of $$$.

Take care, have a nice coding future!