|
FWIW
In VS, set focus to a brace, CTRL_} finds the matching brace.
There are strangers on the Plain, Croaker
|
|
|
|
|
You could always:
}//End of switch logic
}//End of if peter knows jane
}//End of while loop
}//Finally! end of dam program TG Of course then you would have the never put comments in code police on your tail. Also, you'd have to pray your comments are relative to what has really ended. In case you are wondering, TG is the same as in TGIF.
|
|
|
|
|
I love the code completion features in my editors. I use Visual Studio and Sharp Develop. When I type in if and hit tab it stubs in the braces and brackets. For and if/else I use ife tab.
After the closing bracket I put in two slashes and a comment following the block. This way when I run into "dribble" (the stream of closing brackets yo showed) each on of the closing brackets hass a comment identifying what that bracket closes. It's tedious to get into the habit but it helps late at night when you are debugging things line by line and you get distracted by the family in your home office. ("Where the %^#$& did I leave off?")
|
|
|
|
|
Left brace, right brace, back arrow, code...
|
|
|
|
|
Sounds like a dance move, cha cha cha
|
|
|
|
|
That it pretty much is - definitely muscle memory at this stage.
|
|
|
|
|
Is it just me... VS2013 automatically creates the closing bracket whenever I type an opening...?
|
|
|
|
|
It does for me, also. I still have the default setup. Note that it also does that in text documents, when I don't want it to. And in code, typing the closing element can add an extra one (I think that happens if I use cursor keys to edit before closing).
|
|
|
|
|
Duncan Edwards Jones wrote: Left brace, right brace, back arrow, code...
Exactly!
Marc
|
|
|
|
|
|
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
|
|
|
|
|
Rotate your monitor 90 degrees, to portrait orientation.
No kidding.
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|
|
I have been tempted to rotate one of my two monitors, but I have to do other stuff which is best in landscape. Maybe I need more monitors! Keep up that winter tan...
|
|
|
|
|
|
how about...
instead of
if (condition)
{
....
}
use
if (!condition)
return;
....
|
|
|
|
|
Not just that, but be consistent in your if statements if you don't want braces issue. i.e. ALWAYS use the braces, even in the above !condition case.
Personally I find Resharper is an excellent tool to help "flatten" you code by suggesting inverting your if statements.
if (!condition)
{
return;
}
|
|
|
|
|
I am consistent!!!
If (one short liner or set value) put on the same line
else if (one long line) put below
else use brace!
See, I even use if to define if behavior! Top that!
|
|
|
|
|
True but I lke to see Return(); at the end of a function. Just makes it easier to read.
I may not last forever but the mess I leave behind certainly will.
|
|
|
|
|
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?
|
|
|
|
|
Never knew that one. I'll have to give it a go.
|
|
|
|
|
|
I code in VB and C# at work - my preference is for C~ due to what I describe as its 'elegance'.
Occasionally when I swap over I catch myself adding a semicolon to some VB code however Visual Studio catches it and I soon remember that I am coding on VB.
I don't find it too big a deal - being bilingual(English and French), for me it's a similar experience swapping between two programming languages and two spoken languages.
Sometimes when I see some horrendous VB code I am heard to exclaim "Put*in de b*rdel de m*rde!" when I meant to comment in English
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
As others have said, I close braces on opening them (well, I cheat and let ReSharper do that), and I keep the number of braced scopes in a method to a minimum, e.g. avoid nested braces like the plague. The highest level I normally get to is say for one loop or switch at a time.
No object is so beautiful that, under certain conditions, it will not look ugly. - Oscar Wilde
|
|
|
|
|
I stick to languages derived from c. Currently mostly c, java and perl.
I have no problems switch between these.
Pitch to one of your managers to have the code you're maintaining rewritten in C#... Or rewrite it in C# and tell your boss what you've did and if they'd be interested in changing over to it. To my knowledge there should be no reason to write any code in vb... If we employ people, it is never a requirement to only know vb or only know C#... Its usually in the lines of, do you have vb or C# experience. As the task at hand can usually be performed in either.
According to Wikipedia there are 89 different c derivative languages. C obviously had a winning recipe. Your subject should read 'Damn vb (why do they have to think they are special and different)'.
"Program testing can be used to show the presence of bugs, but never to show their absence."
<< please vote!! >></div>
|
|
|
|
|
Maintain codebase in vb.
There is nothing different between the two...except may be for productivity features enabled through use of the ide.
There are probably other ide that give better productivity support.
Try sharp develop for a change : [^]
|
|
|
|