Generated by a tool?
[Update: This is a repost of a post I made on Friday 5/6, since the original post was lost due to a problem in the server software. Unfortunately, I don't yet have the comments I received on the original post, but I will reinstate them if/when they are extracted.]
As I have mentioned in earlier posts, the MSDN Product Feedback Center is a great way for customers to report bugs and suggestions directly to the product teams in Microsoft. I think this has been a great success especially for VS 2005/.NET 2.0 and we have had a steady stream of issues come in.
The issues range from very specific bug reports to creative suggestions about how VS 2005 can help increase developer productivity. Here is a recent suggestion that falls into the latter category:
(quoted from https://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=deb33595-a59f-41ae-b73f-70a3b2e34cf3)
Problem Statement: Opened by asaeman on 2005-04-26 at 11:50:42
Autogenerated code in Visual studio is preceeded by the comment section that includes:
<autogenerated>This code was generated by a tool.</autogenerated>The word "tool" may be used as an insult, describing someone who is being manipulated without their knowledge - implying they are naive and ignorant. [https://en.wikipedia.org/wiki/Tool_(insult)]
I don't mind this showing up in code that others write and in fact when I first saw that phrase I started laughing. "What a tool!, I can't believe he(she) wrote that code - no wonder it doesn't work!!!". However, when it shows up in projects that I'm developing, it's kind of insulting. "Are you calling me a tool?"
Proposed Solution:I would change the line: "This code was generated by a tool" to:
1) "This code automagically appeared here" - automagically is a great word.
2) Or for a more serious solution:
"This code was autogenerated" - Maybe move it underneath the runtime version and just above. "Changes to this file may cause incorrect behavior and will be lost if the code is regenerated." so it's not immediately underneath the <autogenerated> tag.
3) Just remove the line - the comment is enclosed in an autogenerated section.Note: I checked Faster Development below because I develop code faster when I'm not insulted.
I agree - in fact, as one of the developers that works on the code generator/serializer in VS, I think the insult is directed more at me than the user, since in some sense, I feel responsible for the code being referred to. Anyway, the issue is somewhat mitigated in VS 2005 because this generated code is hidden away in a partial class. Hopefully no one will ever look in that file :-)
Comments
Anonymous
May 10, 2005
T and F are in close proximity on the keyboardAnonymous
May 10, 2005
But... reading your last paragraph, you're not going to change the text? ;)Anonymous
May 10, 2005
Don't you believe it, I look in the partial classes all the time. Sometimes it's easier to cut'n'paste rather than mess with the GUI.
I'll take the risk that I break the roundtripping stuff but sometimes it's just so much easier.Anonymous
May 10, 2005
Most code is generated by "tools" ie, developers.Anonymous
May 10, 2005
Okay - reinstated the comments on the original post manually.Anonymous
October 23, 2005
I think the autogenerated comments should include more information. Take a look at what MIDL generates. (remember MIDL?)
Here are some things that are useful to have in an auto-generated file:
Generated at 07:36:47am 10/23/2005 PST
Generated by D:dev.binaries.amd64chktoolsSmartGen.exe -d -f "somepathsomefile.xml"
The last one includes a lot that could be broken into different lines:
-path to generator
-name of generator
-args used to generate
-input file to the generator
One thing I particularly like about the all of that is that it gives me the exact information I may need if I would like to manually regenerate the file, if need be.
Obviously, the designer-generated files might not be able to provide all of the above info. The point is, though, that just telling me it was autogenerated can be insulting to ME, implying that I'm too much of a tool to need to understand what's going on in the source file. I usually do need to understand it, and sometimes I'd like to regenerate it.Anonymous
December 13, 2006
When you use either VBCodeProvider or CSharpCodeProvider and generate the code use this method to generate the class: GenerateCodeFromNamespace instead of GenerateCodeFromCompileUnit.Anonymous
February 03, 2007
The comment has been removed