3 added 320 characters in body
source | link

When you look at the code for the Winforms Designer, you see things like this:

this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", ... etc.

instead of

using System.Drawing;
label1.Font = new Font("Microsoft Sans Serif", ... etc.

The same is true of tools like Linq to XSD, XSD2Code and, I suspect, of Linq to SQL. These tools generate hoards of code with extremely long fully-qualified names.

Wouldn't it be easier to generate the appropriate using statements, and ditch the long names? Or is there some technical reason for this that I'm missing?


Note: For those folks that are baffled by the notion that I might want these classes to actually be readable by a human, note that this is exactly my goal. I have an XSD with about 300 classes in it, I don't want to write them all by hand, and yes, I'd like them to look like ordinary code written by humans.

When you look at the code for the Winforms Designer, you see things like this:

this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", ... etc.

instead of

using System.Drawing;
label1.Font = new Font("Microsoft Sans Serif", ... etc.

The same is true of tools like Linq to XSD, XSD2Code and, I suspect, of Linq to SQL. These tools generate hoards of code with extremely long fully-qualified names.

Wouldn't it be easier to generate the appropriate using statements, and ditch the long names? Or is there some technical reason for this that I'm missing?

When you look at the code for the Winforms Designer, you see things like this:

this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", ... etc.

instead of

using System.Drawing;
label1.Font = new Font("Microsoft Sans Serif", ... etc.

The same is true of tools like Linq to XSD, XSD2Code and, I suspect, of Linq to SQL. These tools generate hoards of code with extremely long fully-qualified names.

Wouldn't it be easier to generate the appropriate using statements, and ditch the long names? Or is there some technical reason for this that I'm missing?


Note: For those folks that are baffled by the notion that I might want these classes to actually be readable by a human, note that this is exactly my goal. I have an XSD with about 300 classes in it, I don't want to write them all by hand, and yes, I'd like them to look like ordinary code written by humans.

    Tweeted twitter.com/#!/StackProgrammer/status/301589962791460864
2 added 43 characters in body
source | link

When you look at the code for the Winforms Designer, you see things like this:

this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", ... etc.

instead of

using System.Drawing;
label1.Font = new Font("Microsoft Sans Serif", ... etc.

The same is true of tools like Linq to XSD, XSD2Code and, I suspect, of Linq to SQL. These tools generate hoards of code with extremely long fully-qualified names.

Wouldn't it be easier to generate the appropriate using statements, and ditch the long names? Or is there some technical reason for this that I'm missing?

When you look at the code for the Winforms Designer, you see things like this:

this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", ... etc.

instead of

using System.Drawing;
label1.Font = new Font("Microsoft Sans Serif", ... etc.

The same is true of tools like Linq to XSD and, I suspect, of Linq to SQL. These tools generate hoards of code with extremely long fully-qualified names.

Wouldn't it be easier to generate the appropriate using statements, and ditch the long names? Or is there some technical reason for this that I'm missing?

When you look at the code for the Winforms Designer, you see things like this:

this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", ... etc.

instead of

using System.Drawing;
label1.Font = new Font("Microsoft Sans Serif", ... etc.

The same is true of tools like Linq to XSD, XSD2Code and, I suspect, of Linq to SQL. These tools generate hoards of code with extremely long fully-qualified names.

Wouldn't it be easier to generate the appropriate using statements, and ditch the long names? Or is there some technical reason for this that I'm missing?

1
source | link

Why do code generators always use fully-qualified identifiers?

When you look at the code for the Winforms Designer, you see things like this:

this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", ... etc.

instead of

using System.Drawing;
label1.Font = new Font("Microsoft Sans Serif", ... etc.

The same is true of tools like Linq to XSD and, I suspect, of Linq to SQL. These tools generate hoards of code with extremely long fully-qualified names.

Wouldn't it be easier to generate the appropriate using statements, and ditch the long names? Or is there some technical reason for this that I'm missing?