Refactoring and ReSharper

I believe, all the published coding methodologies, practices and guidelines strive to achieve one simple thing: I said it – Simplicity – making things simple, easier to understand, easier to maintain. Refactoring, is one such practice, which we all might have been doing for ages, perhaps without knowing that the practice is labeled ‘Refactoring’. By definition, Refactoring is all about changing the structure of code without changing its expected behavior. Why do it – to simplify, simply put.

There are many refactoring techniques one might want to use with respect to object oriented programming. I wouldn’t enunciate all of them here; I would recommend Martin Fowler’s most excellent book for the same. Consider one such common technique – Rename. As benign as this might appear, Renaming is one of the most powerful steps towards simplicity. Be it a member variable, a formal parameter, a method name or the class name, proper (re)naming should portray the true intent and eliminate the need for comments. Another common technique is Extract Method. More often than not, a method gets bulky and its real intent starts becoming hazy. At such times, you may want to break it up into smaller methods so that the code becomes more ‘readable’ and hence maintainable.

Now, the techniques that I have just mentioned require some amount of manual effort in the code editor (IDE). For instance, changing the name of a member variable would mean changing them in all class methods where it is used. These changes could be drastic, if the members/methods are public. Manual effort is but, error prone and typically, refactoring entails unit tests to certify that expected behavior is not violated. To that end, wouldn’t it be great to have a tool of sorts which automates most of such common refactoring techniques? VS.NET is a far cry in this respect; so, ReSharper comes to the rescue!

Well actually, the very purpose of this blog post was to share with you, my experiences of working with this fabulous tool. ReSharper is essentially, a refactoring tool that comes as an add-on to the VC# IDE provided by VS.NET 2003. In addition to facilitating some refactoring techniques, ReSharper provides enhanced navigation, formatting and intellisense enhancements over and above what VS.NET provides, which make C# development even more pleasurable. There is good reason to see why VS 2005 provides most, if not all of what ReSharper provides already.

Well yes, as the name would suggest, ReSharper is a tool that works only with C#. I don’t want to get too philosophical here, but it seems as if VB.NET was perhaps, alienated from ReSharper for the same reason why Refactoring (or most of it) was opted out of VB 2005. (Ofcourse, time and scope, among many other things could have been a reason). In my opinion, refactoring is a technique that cuts across all languages and has to be adopted (I must say religiously) by all programmers, whatever be their language of choice for development. I am also of the opinion that IDEs have to provide refactoring support in some form or the other.

Nonetheless, ReSharper has been one of the best developer tools I have ever worked with. It is truly a developer productivity enhancer and I personally would recommend ReSharper for every C# developer working on VS.NET 2003. Its more than worth 149$; go get your copy today. With ReSharper, refactoring is fun too !


2 thoughts on “Refactoring and ReSharper”

Leave a Reply

Your email address will not be published. Required fields are marked *