I ran across a post from Buck Woody recently about code writing code, which I thought was a great post. It talks about writing code generation routines that save you time. An example given is writing code the reads your table definitions and then can produce triggers for auditing.
To me, this is one of those areas that starts to separate out the beginners from the mid-level, from the senior people that write code. It's when you realize that not only can the computer do work for you, but also write the code that tells it what work to do. When you are getting started, you often don't realize that the investments in writing code to write code pay back many times over. It takes some time to learn that this is a way of becoming more efficient in the way you approach your craft.
However it's more than just getting more work done. One of the great things about letting the computer write code is that it produces consistent code, adhering to your standards perfectly without typos and minor changes that you might introduce if the routines were rewritten one at a time. The style, the indents, naming, etc. are followed exactly as you've coded the routines.
And if you improve your code to eliminate bugs or run more efficiently, you can easily regenerate all code quickly!
There are numerous advantages, with the only disadvantage being if you cannot write this code itself relatively quickly. However as you that usually changes with a little practice, and a lot of experience.
If you find yourself unwilling to write code to write code, perhaps you ought to stop and re-evaluate where you are in your career, and if you are really progressing over time.
Steve Jones
The Voice of the DBA Podcasts
The podcast feeds are available at sqlservercentral.mevio.com. Comments are definitely appreciated and wanted, and you can get feeds from there.
You can also follow Steve Jones on Twitter:
or now on iTunes!
- Windows Media Podcast - 25.4MB WMV
- iPod Video Podcast - 18.3MB MP4
- MP3 Audio Podcast - MB MP3
Today's podcast features music by Everyday Jones. No relation, but I stumbled on to them and really like the music. Support this great duo at www.everydayjones.com.