Damn c# { }'s
-
Now, I am not interested in a VB versus C# debate but. In my job I only spend about 20% of my time coding. Being from a C# background anything new I would normally do in C# (and yes very occasionally VB), but I also have to maintain old VB code (and heaven forbid, very occasionally VB6). Normally I spent a month or two in each language (depending on the task at hand) and are happy in any camp. Changing back and forth between languages is relatively straight forward, but lately I noticed it takes me longer to get back into swing of C#. And the reason.. Well, I think its because I've got myself into bad c# typing habits from using vb. I seem to be wasting so time chasing missing / misplaced { }, forgetting semicolons case sensitivity and ()'s. Now semicolons, case and () problems are just a "Oh Bugger" moment, but as for missing / misplaced { } 's. They can be time waster. For all you pro c# developers, Do you have any tips on keeping these damn { } under control?
-
Now, I am not interested in a VB versus C# debate but. In my job I only spend about 20% of my time coding. Being from a C# background anything new I would normally do in C# (and yes very occasionally VB), but I also have to maintain old VB code (and heaven forbid, very occasionally VB6). Normally I spent a month or two in each language (depending on the task at hand) and are happy in any camp. Changing back and forth between languages is relatively straight forward, but lately I noticed it takes me longer to get back into swing of C#. And the reason.. Well, I think its because I've got myself into bad c# typing habits from using vb. I seem to be wasting so time chasing missing / misplaced { }, forgetting semicolons case sensitivity and ()'s. Now semicolons, case and () problems are just a "Oh Bugger" moment, but as for missing / misplaced { } 's. They can be time waster. For all you pro c# developers, Do you have any tips on keeping these damn { } under control?
I find that after spending a day doing Ruby programming, my soul cries out to at least write a few lines of C# code in the evening. Ah... But to your question, my fingers are so programmed to type {} whenever I write a method, I can't really help you there. In fact, in Ruby where occasionally one does use {} I get really pissed off at the IDE for auto-completing the closing }. Or ] or ). Hmmm...I bet there's a way to kill that in RubyMine. :) Marc
Imperative to Functional Programming Succinctly Contributors Wanted for Higher Order Programming Project!
-
I find that after spending a day doing Ruby programming, my soul cries out to at least write a few lines of C# code in the evening. Ah... But to your question, my fingers are so programmed to type {} whenever I write a method, I can't really help you there. In fact, in Ruby where occasionally one does use {} I get really pissed off at the IDE for auto-completing the closing }. Or ] or ). Hmmm...I bet there's a way to kill that in RubyMine. :) Marc
Imperative to Functional Programming Succinctly Contributors Wanted for Higher Order Programming Project!
-
Now, I am not interested in a VB versus C# debate but. In my job I only spend about 20% of my time coding. Being from a C# background anything new I would normally do in C# (and yes very occasionally VB), but I also have to maintain old VB code (and heaven forbid, very occasionally VB6). Normally I spent a month or two in each language (depending on the task at hand) and are happy in any camp. Changing back and forth between languages is relatively straight forward, but lately I noticed it takes me longer to get back into swing of C#. And the reason.. Well, I think its because I've got myself into bad c# typing habits from using vb. I seem to be wasting so time chasing missing / misplaced { }, forgetting semicolons case sensitivity and ()'s. Now semicolons, case and () problems are just a "Oh Bugger" moment, but as for missing / misplaced { } 's. They can be time waster. For all you pro c# developers, Do you have any tips on keeping these damn { } under control?
Left brace, right brace, back arrow, code...
-
Left brace, right brace, back arrow, code...
-
I main problem I seem to is after a lot of if, Switch or whatever and you end up with a lot of
}
}
}
}and then trying to figure which } belong with which {
RossMW wrote:
and then trying to figure which } belong with which {
Dang, doesn't the IDE (dimly, I'll grant) light up the matching braces? [on my high horse] If you have that much nesting, maybe you should break the function apart into smaller calls? [/on my high horse] Marc
Imperative to Functional Programming Succinctly Contributors Wanted for Higher Order Programming Project!
-
Left brace, right brace, back arrow, code...
Duncan Edwards Jones wrote:
Left brace, right brace, back arrow, code...
Exactly! Marc
Imperative to Functional Programming Succinctly Contributors Wanted for Higher Order Programming Project!
-
RossMW wrote:
and then trying to figure which } belong with which {
Dang, doesn't the IDE (dimly, I'll grant) light up the matching braces? [on my high horse] If you have that much nesting, maybe you should break the function apart into smaller calls? [/on my high horse] Marc
Imperative to Functional Programming Succinctly Contributors Wanted for Higher Order Programming Project!
-
That it pretty much is - definitely muscle memory at this stage.
-
Now, I am not interested in a VB versus C# debate but. In my job I only spend about 20% of my time coding. Being from a C# background anything new I would normally do in C# (and yes very occasionally VB), but I also have to maintain old VB code (and heaven forbid, very occasionally VB6). Normally I spent a month or two in each language (depending on the task at hand) and are happy in any camp. Changing back and forth between languages is relatively straight forward, but lately I noticed it takes me longer to get back into swing of C#. And the reason.. Well, I think its because I've got myself into bad c# typing habits from using vb. I seem to be wasting so time chasing missing / misplaced { }, forgetting semicolons case sensitivity and ()'s. Now semicolons, case and () problems are just a "Oh Bugger" moment, but as for missing / misplaced { } 's. They can be time waster. For all you pro c# developers, Do you have any tips on keeping these damn { } under control?
Spend more time coding in C-style syntaxes rather than BASIC style ones. We're creatures of habit and muscle memory doesn't make this issue any better.
Jeremy Falcon
-
RossMW wrote:
and then trying to figure which } belong with which {
Dang, doesn't the IDE (dimly, I'll grant) light up the matching braces? [on my high horse] If you have that much nesting, maybe you should break the function apart into smaller calls? [/on my high horse] Marc
Imperative to Functional Programming Succinctly Contributors Wanted for Higher Order Programming Project!
Actually that's a closing brace for your namespace, class, method and if statement. Not much nesting at all, it just looks that way in C# :) This is where I'd usually sing some VB praise, but having been away from VB for far too long I'm just not in the mood :laugh:
Visit my blog at Sander's bits - Writing the code you need. Or read my articles at my CodeProject profile.
Simplicity is prerequisite for reliability. — Edsger W. Dijkstra
Regards, Sander
-
Actually that's a closing brace for your namespace, class, method and if statement. Not much nesting at all, it just looks that way in C# :) This is where I'd usually sing some VB praise, but having been away from VB for far too long I'm just not in the mood :laugh:
Visit my blog at Sander's bits - Writing the code you need. Or read my articles at my CodeProject profile.
Simplicity is prerequisite for reliability. — Edsger W. Dijkstra
Regards, Sander
Sander Rossel wrote:
Actually that's a closing brace for your namespace, class, method and if statement.
Heh, good point. I usually never pay much attention to those. :) Marc
Imperative to Functional Programming Succinctly Contributors Wanted for Higher Order Programming Project!
-
Now, I am not interested in a VB versus C# debate but. In my job I only spend about 20% of my time coding. Being from a C# background anything new I would normally do in C# (and yes very occasionally VB), but I also have to maintain old VB code (and heaven forbid, very occasionally VB6). Normally I spent a month or two in each language (depending on the task at hand) and are happy in any camp. Changing back and forth between languages is relatively straight forward, but lately I noticed it takes me longer to get back into swing of C#. And the reason.. Well, I think its because I've got myself into bad c# typing habits from using vb. I seem to be wasting so time chasing missing / misplaced { }, forgetting semicolons case sensitivity and ()'s. Now semicolons, case and () problems are just a "Oh Bugger" moment, but as for missing / misplaced { } 's. They can be time waster. For all you pro c# developers, Do you have any tips on keeping these damn { } under control?
Rotate your monitor 90 degrees, to portrait orientation. No kidding.
I wanna be a eunuchs developer! Pass me a bread knife!
-
Now, I am not interested in a VB versus C# debate but. In my job I only spend about 20% of my time coding. Being from a C# background anything new I would normally do in C# (and yes very occasionally VB), but I also have to maintain old VB code (and heaven forbid, very occasionally VB6). Normally I spent a month or two in each language (depending on the task at hand) and are happy in any camp. Changing back and forth between languages is relatively straight forward, but lately I noticed it takes me longer to get back into swing of C#. And the reason.. Well, I think its because I've got myself into bad c# typing habits from using vb. I seem to be wasting so time chasing missing / misplaced { }, forgetting semicolons case sensitivity and ()'s. Now semicolons, case and () problems are just a "Oh Bugger" moment, but as for missing / misplaced { } 's. They can be time waster. For all you pro c# developers, Do you have any tips on keeping these damn { } under control?
Consistent formatting.
-
Actually that's a closing brace for your namespace, class, method and if statement. Not much nesting at all, it just looks that way in C# :) This is where I'd usually sing some VB praise, but having been away from VB for far too long I'm just not in the mood :laugh:
Visit my blog at Sander's bits - Writing the code you need. Or read my articles at my CodeProject profile.
Simplicity is prerequisite for reliability. — Edsger W. Dijkstra
Regards, Sander
-
Rotate your monitor 90 degrees, to portrait orientation. No kidding.
I wanna be a eunuchs developer! Pass me a bread knife!
-
Yes, very dimly. Makes it hide to find when you have to scroll to see it. Just have to remember the Left brace, right brace, back arrow, code... dance move...
-
-
Now, I am not interested in a VB versus C# debate but. In my job I only spend about 20% of my time coding. Being from a C# background anything new I would normally do in C# (and yes very occasionally VB), but I also have to maintain old VB code (and heaven forbid, very occasionally VB6). Normally I spent a month or two in each language (depending on the task at hand) and are happy in any camp. Changing back and forth between languages is relatively straight forward, but lately I noticed it takes me longer to get back into swing of C#. And the reason.. Well, I think its because I've got myself into bad c# typing habits from using vb. I seem to be wasting so time chasing missing / misplaced { }, forgetting semicolons case sensitivity and ()'s. Now semicolons, case and () problems are just a "Oh Bugger" moment, but as for missing / misplaced { } 's. They can be time waster. For all you pro c# developers, Do you have any tips on keeping these damn { } under control?
how about... instead of
if (condition)
{
....
}use
if (!condition)
return;
....All in one Menu-Ribbon Bar DirectX for WinRT/C# since 2013! Taking over the world since 1371!
-
Now, I am not interested in a VB versus C# debate but. In my job I only spend about 20% of my time coding. Being from a C# background anything new I would normally do in C# (and yes very occasionally VB), but I also have to maintain old VB code (and heaven forbid, very occasionally VB6). Normally I spent a month or two in each language (depending on the task at hand) and are happy in any camp. Changing back and forth between languages is relatively straight forward, but lately I noticed it takes me longer to get back into swing of C#. And the reason.. Well, I think its because I've got myself into bad c# typing habits from using vb. I seem to be wasting so time chasing missing / misplaced { }, forgetting semicolons case sensitivity and ()'s. Now semicolons, case and () problems are just a "Oh Bugger" moment, but as for missing / misplaced { } 's. They can be time waster. For all you pro c# developers, Do you have any tips on keeping these damn { } under control?
The keyboard shortcut "control }" will jump to the matching bracket if you can't immediately identify it. It will work when the cursor is either before or after an opening bracket or a closing bracket. I'd use that command every 5 minutes. very helpful when the scope of a set of brackets extends beyond the visible portion of the page.
who knows what evil lurks in the hearts of men?