Paul Sheriff's Outer Circle Blog

This blog is for my ramblings and to share my tips, tricks and advice garnered over 20+ years in the IT industry. I will be pulling a lot of the best questions from my Inner Circle and bring you those answers here as well.

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 (http://www.codesmithtools.com/).

 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

 

Comments

Community Server Daily News said:

news of the day a grab bag for what's happening in Community Server We'll begin today's news

# August 15, 2006 3:26 PM

Luciano Terra said:

Hey Paul, Here is another nice tool, with is free! http://www.mygenerationsoftware.com/
# August 26, 2006 8:21 PM

Balachandar said:

Hi,

MyGeneration is much better and is free too!!!

Though I liked codesmith well, it is costly.

So MyGeneration became a choice for code generation.

# January 4, 2007 11:41 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)