Are there any tools for Craft similar to the Yii Code Generator? There is Yii demo tutorial at http://www.yiiframework.com/screencasts/ that uses the Yii Code Generator. Are there similar Code Generator tools in Craft?
There are third-party code generators, such as the Element Type Generator or the Craft Plugin Generator

You also have the migration tools that generate code. Using the querygen command you can output Records as db query commands.