In an ideal world we'd move ideas into code on a computer using our minds. We'd like to treat our code like putty, to be shaped into whatever our minds can imagine - and then reshape it as requirements change, of course :-).
Unfortunately, this isn't an ideal world, so we're forced to use the keyboard and mouse but we should never stop aspiring to the ideal of code-as-putty.
There are two common routes to this ideal, given that we're stuck with keyboards and source files:
- the syntax and semantics of the language itself
- tool support
Sometime ago, I'd posted a rant calling VS2008 a piece of crap. In his typically polite way, Ramesh pointed out in his post that provocative titles and rants aren't always the best way to convey one's message. He's absolutely right. So to that end, I'm going to start posting productivity enhancing IDE tips and tricks I come across as I write code every day. Posts will be short, something I can compose when I'm taking a break and getting a cup of chai or some fruit juice in the pantry. Three lines of text, a couple of screen-shots, that's it.
To start with it'll be all in VS2008+ReSharper as I'm currently developing in C#, but I intend to continue this series as I move from one language to another - and I welcome any suggestions or improvement anyone may have, whether it's Lisp, Erlang, Java, Ruby or C#. Anything which makes the lives of those on those platforms that little bit easier :-).
A little tidbit to get started - smart code complete when filling in parameters.
If you're using a method which takes a bunch of parameters, here's a quick way to fill them in without having to look up the param list for that method. Just position the cursor inside the brackets and hit Ctrl+Shift+Space and you'll get the most plausible option from the variables available. ReSharper looks at the types and names of variables in scope at that point to do this and is almost always accurate. Instead of looking up docs, you simply hit Ctrl+Shift+Space a few times and your parameters will be populated. In the shot above, even though all the parameters being passed are strings, ReSharper correctly guesses their order based on variable names.
ReSharper also helpfully pops up the parameter list in cases where methods are overloaded to help you decide how many times you should press Ctrl+Shift+Space.