Those who are tasked with keeping up or moving away from Visual Basic 6 code already know that Microsoft broke a lot of functionality when it moved up to Visual Basic .NET and into the Visual Studio environment. Those same folks have probably wrestled with the Migration Wizard to try to move as much of their code bases as possible from the old world to the new, with varying degrees of success. For the code that resists the use of this sometimes helpful, sometimes frustrating Wizard, the notion of refactoring will probably come into play.
According to the experts, refactoring means improving code that's already been written by changing its internal structure without changing its external behavior. In some important ways, this also ends up being a good description of the kinds of efforts involved in moving a pre-.NET code base into the .NET world and onto the corresponding .NET Framework.
Microsoft appears to agree with this analysis, to the extent that a search on MSDN for refactoring turns up numerous interesting resources, including multiple articles on the subject as well as multiple collections of code snippets and some interesting tools. Visual C# goes so far as to include a Refactoring menu entry, which is itself the subject of a couple of interesting articles: Refactoring and Refactoring C# Code Using Visual Studio 2005. Be sure to check out the tools listed in the Refactoring category while you're at it as well.
The VS 2005 article makes an interesting exploration of refactoring support available in Visual Studio 2005, including the aforementioned Refactoring menu, as well as related keyboard shortcuts, various SmartTags and context-sensitive mouse right-clicks inside the environment. Those interested in making the most of their code investments will find this intriguing, but those who must try to move older VB or C code from pre-.NET implementations into the .NET world will find this both fascinating and valuable. For a less MS-centric view of this phenomenon, you'll also find some good general books on this subject next.
Looking at the books available on this subject, it looks like the same editorial gang that put the whole Design Patterns thing together in the 90s, has a total lock on refactoring as well. Interested readers will find one or more of the following titles interesting if they want more details on refactoring.
- Refactoring: Improving the Design of Existing Code by Martin Fowler, et al, Addison-Wesley Professional, June 28, 1999, ISBN: 0201485672.
- Refactoring to Patterns by Joshua Kerievsky, Addison-Wesley Professional, August 5, 2004, ISBN: 0321213351.
- Refactoring Workbook by William C. Wake, Addison-Wesley Professional, August 22, 2003, ISBN: 0231109295.
Ed Tittel is a writer and trainer whose interests include XML and development topics, along with IT Certification and information security. E-mail email@example.com with comments, questions, or suggested topics or tools to review. Cool tools rule!
This was first published in November 2006