Code Generation

I have been speaking at a lot of user groups lately and I always ask how many people are generating code. It is astounding to me just how many people DO NOT do this! Programmers are still writing CRUD (Create, Read, Update, Delete) logic by hand! Code generation has been around for years. Why not take advantage of it? You could use the built-in tools in .NET or go out and purchase an excellent code generation tool like CodeSmith (

 If you have not tried generating code yet for your basic stored procedures and classes to call those stored procedures, what are you waiting for? Jump in! The water is fine! We all need ways to speed up our development cycle, code generation is one way to do it.

There are a lot of reasons for using Code Generation, here are a few:

·        Generation of INSERT, UPDATE and DELETE statements

·        Generation of stored procedures to do INSERT, UPDATE and DELETE

·        Bullet proof code for doing the Create, Read, Update, Delete (CRUD) logic

·        Ability to regenerate CRUD classes if schema changes

·        Consistency of code from one application to another

·        Moves SQL out of the UI tier and into a middle tier where it belongs

·        Moves the dependence on a particular database provider out of the UI

·        Reduces code complexity in the UI layer

·        Ability to map columns to properties in a class

·        Provide IntelliSense of tables, stored procedures, views and columns

·        Provides strong-typing of data in one location

·        Ability to customize templates to fit “your” style

·        Abstracts and encapsulates all data access code

·        Ability to separate programmers working on UI and data access


Past Blog Content

Blog Archive


Comments have been disabled for this content.