Archives

Archives / 2003 / October
  • Whidbey: refactoring in the VS IDE

    One of the real cool new features in the Whidbey source code editor is the refactoring functionality. This is something you want today if you have to rewrite parts of a large codebase.

    The following refactoring functionality is available:

    Rename: select a symbol to rename, specifiy a new name and everywhere this name is used in your project it is renamed.

    Change signature: here you can do one of the following actions:

    Reorder parameters
    Remove parameters
    Add a parameter
    Rename a parameter
    Rename a method
    Change a parameter type

    Extract method: select a piece of code and seperate it into a method that is called instead.

    Extract interface: given a class, select the methods and properties you want to be available in your interface and specify an interface name and a new interface is created and your class automatically implements it.

    Encapsulate field: select a field in your class, and encapsulate it as a property. All references to this property are also automatically updated. In this update you can select if you only want the external references or all references to be updated. It is a pity that not all approaches as described in Martin Fowlers book "Refactoring" are implemented, like promoting a method to it's base class or demoting a method to a derived class. However it is a big step forward directly available from the IDE you work in.

    The cool thing is that much of this functionality is also available in the diagram view (UML) of the code.