Tuesday, June 24, 2008

Refactoring: Assignment Reversal

If you've been creating ASP.NET web applications long enough, you'll find that the most repetitive tasks are creating form fields based on database tables, adding validators and their associated callout extenders, and assigning values to controls in the Page_Load method and assigning them back to the objects in the event handlers.

The one feature I've been hoping to see in Visual Studio is the ability to refactor code by inverting assignments i.e. turning a = b into b = a, so I can copy across most of the code from Page_Load into the event handler. I wonder if there's any Visual Studio Add-In that does this, preferably something open source. I believe I've seen it in some IDE before... I'm not sure, but I think it was Borland JBuilder.

No comments: