Friday, November 25, 2005

Whidbey refactoring feature.

One of the many cutest features that appealed to me in Whidbey was code refactoring. So here are some of my comments on few of those code refactor options that I tried this week.

Rename: You select a variable or method and choose rename from refactor, it renames all instances of that variable. Its different from find text in solution option. It smartly searches, and shows only matching variables or methods rather than just showing every possible instance of text match.
Change signature : lets you add, modify or delete parameters from method signatures.
Extract method: This is another neat feature that developers often need. Extract method creates a new method out of code that you selected. It creates required parameters and all automatic formatting and calls it from the code.
Encapsulate Field: This is another feature that saves us from coding properties. Just choose the private variable and select Encapsulate field and eureka your property is ready.
Extract Interface: lets you create an interface and its implementation from your class.
A must see- 3 minute online demo of refactor feature on microsoft site.
Refactoring is just one of the many new additions to the visual studio 2005. Will add some more soon.

After blogging on refactoring i went on reading more about it and found that it is stripped off from Visual Basic 2005 release. Microsoft came up saying that it was not possible to finish work on refactoring along with the numerous other goals and projects for the 2005 release, and suggested to use Refactor! for visual basic 2005