During a recent journey of discovery through the world of Visual Studio related tools, I came across the subject of this week's tip — a nifty tool that goes by the name of NET Refactor.
By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
A product from an equally nifty company that goes by the name of Know DOT.NET, NET Refactor is an interesting product that offers some great capabilities. But to understand what it does, you first have to understand the concept of refactoring. One way of looking at this topic is as a way or organizing class definitions to streamline and simplify access to objects, methods, and classes within your code. Another way of looking at it is to say that refactoring means applying a set of simple, single-step transformations to code that restructures its innards without altering its external behavior. The drive behind refactoring is to re-organize internal code structure logically and consistently, to make it modular, readable, and easy to maintain. As an added benefit, refactoring often also produces performance improvements (most modest ones) as well. Much of the work of refactoring can be automated, and that's precisely what NET Refactor does.
In fact, the program's developers have put together a tutorial and examples page that lists loads of general articles on refactoring and that also includes a longish list of specific refactorings known to be of value (and supported in NET Refactor as well). These include ways to reduce the size of large, complex methods and event handlers, consolidation of duplicate in-line strings into constants or string variables, renaming method parameters, isolating interfaces to implement multiple classes, and a whole bunch more. The software's refactoring functions include a complexity analyzer, an "extract method" tool, a tool to simplify complex conditional statements, a tool to build an interface for any selected class, and a smart commenting feature.
Though it may seem mysterious or magical, NET Refactor can analyze and reorganize VB.NET or C#.NET code nicely, and produce cleaner, more compact code as a result. The product also provides nice graphic views of project items, and can report on organization and perform an algorithmic analysis of code complexity. It also includes a bevy of renaming and reordering tools, plus a handful of SQL and ADO refactoring tools as well. The company offers a 30-day trial version.