C
carl.manaster
Hi, Group,
I know it says not to mess with the "code required for Designer
support" that the IDE generates when I work with things in the layout
editor, but I nevertheless find myself making changes along these
lines:
this.bMagnifier = new System.Windows.Forms.Button();
this.bMagnet.Anchor = ((System.Windows.Forms.AnchorStyles)
((System.Windows.Forms.AnchorStyles.Top |
System.Windows.Forms.AnchorStyles.Right)));
this.bMagnet.Location = new System.Drawing.Point(304, 176);
==>
bMagnifier = new Button();
bMagnet.Anchor = ((AnchorStyles)
((AnchorStyles.Top |
AnchorStyles.Right)));
bMagnet.Location = new Point(304, 176);
just so it's easier for me to read.
I realize that it's "safer" for the code generator to so precisely
qualify the items it refers to, and I'm not really quibbling about the
code it generates (maybe a topic for another post). But I'm starting
to consider such qualifications to be what XPers call a "smell" - an
indication that something is wrong about the code.
When I can strip off the qualification and everything still works fine,
that's great. But when - and this has happened in my own code, not
that built by the IDE - qualifications are _required_ for the code to
function properly, it is a clue to me that the function I'm writing
really belongs in another namespace, probably in a different class. Or
that my namespace map is somehow less than ideal - a class isn't where
it belongs, or has a bad name, etc.
In the immortal words of The Onion: What do you think?
Peace,
--Carl
I know it says not to mess with the "code required for Designer
support" that the IDE generates when I work with things in the layout
editor, but I nevertheless find myself making changes along these
lines:
this.bMagnifier = new System.Windows.Forms.Button();
this.bMagnet.Anchor = ((System.Windows.Forms.AnchorStyles)
((System.Windows.Forms.AnchorStyles.Top |
System.Windows.Forms.AnchorStyles.Right)));
this.bMagnet.Location = new System.Drawing.Point(304, 176);
==>
bMagnifier = new Button();
bMagnet.Anchor = ((AnchorStyles)
((AnchorStyles.Top |
AnchorStyles.Right)));
bMagnet.Location = new Point(304, 176);
just so it's easier for me to read.
I realize that it's "safer" for the code generator to so precisely
qualify the items it refers to, and I'm not really quibbling about the
code it generates (maybe a topic for another post). But I'm starting
to consider such qualifications to be what XPers call a "smell" - an
indication that something is wrong about the code.
When I can strip off the qualification and everything still works fine,
that's great. But when - and this has happened in my own code, not
that built by the IDE - qualifications are _required_ for the code to
function properly, it is a clue to me that the function I'm writing
really belongs in another namespace, probably in a different class. Or
that my namespace map is somehow less than ideal - a class isn't where
it belongs, or has a bad name, etc.
In the immortal words of The Onion: What do you think?
Peace,
--Carl