Whether or not you realize it, if you are like most developers, you are always refactoring code. Every time you change your code to reduce duplication or rename items for the sake of clarity, you are refactoring. Refactoring is simply putting a name to a common development task. The strict definition of the term is “a change made to the internal structure of software to make it easier to understand and cheaper to modify without changing its observable behavior.” That is, refactoring does not add features to the application. Instead, it improves the general maintenance of the code base.

The term refactoring has received a large amount of attention. A number of good books have been written touting the many benefits of refactoring code as you are building your application. This is when you are closest to the code and thus able to quickly make these maintenance-type changes. Many of these books are on the subject of extreme programming. Refactoring has become one of the key tenets of the extreme programmer. In extreme programming, your code base builds feature by feature to satisfy a series of tests. This can result in code that works wonderfully but does not look as though it was designed as a cohesive unit. To combat this problem, you would be wise to go over the code base at frequent intervals and thus improve the general quality of the code (remove duplication, create common interfaces, rename items, put things into logical groups, and so on).

A new set of features has arisen inside code editors to aid with refactoring. These features have their basis in a real need. No developer wants to introduce errors into a relatively stable code base simply for the sake of improving maintenance—especially when running a tight schedule. Imagine explaining to your manager or client that the large spike in bugs is a result of sweeping changes you made to the code to improve future maintenance and readability. We can be thankful that the C# editor inside Visual Studio 2008 provides a reliable set of refactoring tools. These tools let you make changes to the code base without the concern of creating more problems than you are solving.

Visual Basic developers do have an option for refactoring in Visual Studio 2008. A third-party development house, DevExpress (http://www.devexpress.com), struck a deal with Microsoft to include a version of its product for all Visual Studio 2008 VB .NET developers. However there are a couple of features built into Visual Studio for refactoring database elements.

Source of Information : Sams Microsoft Visual Studio 2008 Unleashed


Subscribe to Developer Techno ?
Enter your email address:

Delivered by FeedBurner