Now that I’m on holiday for a week, I have time to actually do something different like… er… coding! 😉 So, I noticed that CodeRush are offering a free version of their refactoring tool (and then remembered hearing about this last year anyway…) and thought “let’s give it a try”. I’ve only had a brief play around with it – what it seems to offer is primarily some extra refactoring options to those offered “out-of-the-box” by Visual Studio, but I’ve actually been quite impressed by it.
I think it differs from ReSharper in that RS seemed to add lots of other stuff to the VS shell, whereas CodeRush offers extra refactoring macros and that’s it – which I actually like, as that’s really all that I’m interested in at the moment.
I’ve watched a couple of the videos on their website – there are some nice features that it comes with; here are some of the ones that I remember: –
Navigating within phrases based on camel casing
Imagine you had a method called MyMethodWhichUsesCamelCasing. If you leave the caret to the left of the phrase, hitting ALT+RightArrow will move to each word based on the capitalisation.
Auto-created local from method
You can use this to easily create a variable as the result of a method call: –
Press the CodeRush key (on my machine, that’s CTRL + ‘ by default) and you get this (the tooltip shows a preview of what the code will become):
Saves you a few seconds, many times a day 🙂 If you choose “implicit” from the pop-up menu, it will do it as var instead of string.
You can even do this for types which don’t yet exist. Neat.
Create new class
Creates a new class from a type that doesn’t yet exist…
This generates a new class for you based on the name of that type, plus a constructor. Again, nothing groundbreaking, but saves you time.
Create a field from a name
Notice all the other options e.g. a property, enum etc. etc. – big time saver.
Automatically use String.Format
Here’s a really nice one I found – hit TAB on any identifier to move between them:
Declare near usage
Another good one – one which actually statistically has been proven to improve code readability and reliability – is to declare your variables only when you use them. So in the example above, it moves the declaration just above the ToString() call:
Not bad 🙂 CodeRush Express is free as well – might be worth giving it a try? My thought is that for a day or so you’ll probably find coding a bit slower but if you invest the time in learning how to use this, it’ll save you a LOT of time with not too much time invested… but you’ll need to spend the time looking into what it can do, otherwise you simply won’t make use of it.