With the proximity of VS 2005 launch everybody is talking about IDEs. I know it’s not a new discussion, IDE vs Editors, VS vs Notepad, Eclipse vs VIM …
Charles Petzold has written a piece http://charlespetzold.com/etc/DoesVisualStudioRotTheMind.html that has been popular see http://it.slashdot.org/article.pl?sid=05/10/26/1935250&tid=156&tid=166&tid=8 and http://lambda-the-ultimate.org/node/view/1084. He talks about VS tools like Intellisense, form editors and other kind of code generators inside the IDE.
I think every programmer has the same feelings about VS, sometimes you love it, and some times you hate the editors.
If VS is generating code that is far from readable, we must know that, and try to separate VS generated code, from “our code”, and partial classes are going to help too much here. But we need more support to differenciate both.
I like to use Static Analysis Tools like FxCop (now integrated with the IDE), you will see how IDEGeneratedCode does not the default Rules. I also use VIL or NDepend to look for common not recommended practices like, Methods longer than 100 lines, or classes with more than 50 fields, obviously the InitializeComponent method never satisfy this simple rules.
The other big problem with this kind of IDE tools is the Bottom-Up design. I have felt comfortable with Intellisense until I tried (and got inlove ) with TDD, Why I have to write the same things twice? (the first in the test, and the second in the implementation). I need a smart IDE that could infere the method signatures and class interfaces from my test definitions, and I know I would be writing without Intellisense. But maybe another coding tools like CodeSnippets or AutoCode templates can help.
From the testing point of view, you should think “Who cares if IDEGeneratedCode has unit tests while It Works?”. However if you write real programs you know that “ItWorks” it’s not enough, you will have to change your code, and Unit tests can help you a lot with that, but the code generated by the IDE does not include unit tests. But the new VS (only some versions) include a wizard to generate unit tests for your classes, and sincerely I have tried to use it and I think it does not help too much, just creating the unit test skeleton.
There is no simple advice about code generation and IDEs, when, where and how much should we use these tools?
Like everything is a matter of balance, try to figure the future changes in your code, how can you test the main interfaces of the generated code, and how hard is change it.
My best recommendation is taken from the old (but still great) book “The Pragmatic Programmer”. http://www.pragmaticprogrammer.com/ppbook/extracts/wizards.html
Don’t Use Wizard Code You Don’t Understand