Welcome to AddressOf.com Sign in | Help

Refactoring in VB.NET - Suggestions As Requested

OK, I can't believe how much traffic has surrounded the whole VB.NET and Refactoring topic.  The reason why I can't believe the amount of traffic is that the whole thing was kicked off with the following where Paul Vick states:

Some of these features are already slated to be included in the VB.NET Whidbey release, such as symbolic rename, and for others we're open customer feedback as to which ones above they think are important. Or if there are ones you don't see there, we want to hear about them as well! If you leave comments on this entry, I'll make sure they get forwarded to Jay, the PM in charge of this area. (The more specific you are, the better. “Do everything that C# is doing.” is helpful, but “Reorder parameters is the most important to me because blah, blah, blah.” helps us even more!)

Now here's what is very interesting about this whole thing.  Everyone is so focused on the fact that it 'might' not be called 'refactoring' in VB.NET.  However, NOONE seems to be focusing on what is important.  I'm just as guilty as anyone, so after some pondering on the subject, here goes (WARNING: I know very little about 'refactoring'):

  • Symbolic rename
  • I'm assuming this means the ability to select some variable, method, property, class name, etc. and rename it globally in a project.  (If so, how is this any different from Find and Replace)?

  • Extract method
  • I claim ignorance... not sure what this is.

  • Extract interface
  • I claim ignorance... not sure what this is.

  • Encapsulate field
  • I claim ignorance... not sure what this is.

  • Reorder parameters
  • I find this very cool.  There's been times when I've built something, added to the parameters list and then decided that it really would make more sense to reoder the parameters list.

  • Remove parameter
  • Another excellent idea.  Again, for the same reasons as 'Reorder parameters'.

  • Add parameter
  • This is somewhat interesting.  I suppose I have caught myself in the situation for this type of tool, however, I use the ability to do function overloading to accomplish this.  However, it would be useful in the long run.

  • Promote local to parameter
  • I don't see this one as being useful, considering it could be easily accomplish by having an 'Add Parameter' option.  Once the new parameter exists, remove the local variable.

    Also, for clarification, as I stated earlier, I don't care what it's called in the end.  As long as it's easy to get to, works as expected, and makes sense on the placement/treatment... call it whatever.  Refactoring seems like a decent enough name.  I've even asked several people who are just beginning to move to VB.NET from VB6 to guess what 'Refactoring' is.  All of them had a pretty good guess as to what it was, so I don't think that that term would throw anyone using VB.NET.

    Published Tuesday, November 04, 2003 2:27 AM by CorySmith
    Filed under:

    Comments

    # re: Refactoring in VB.NET - Suggestions As Requested

    Tuesday, November 04, 2003 7:26 AM by Phil Weber
    Cory: For a list of common refactorings, with definitions and examples, see http://www.refactoring.com/catalog/

    The fact that you "claimed ignorance" on so many of the items (and apparently didn't know where to go for more information) would seem to reinforce the preception that VB.NET users are not as "hip" to current methodologies as C# and Java developers, thus the VB team's feelings that perhaps they should rename some of the items to make them more accessible to VB devs.

    # re: Refactoring in VB.NET - Suggestions As Requested

    Tuesday, November 04, 2003 12:04 PM by Tommy Bowen
    >(Symbolic rename) I'm assuming this means the ability to select some variable, method, property, class name, etc. and rename it globally in a project. (If so, how is this any different from Find and Replace)?
    ---------------------------------
    If I recall my PDC sessions, this is a renaming of the symbol exclusively. Find-Replace is a context ignorant text function as you know. For example, Find-Replace would change all occurences of a string everywhere, even in comments or if it is unintentionally imbedded in another string. Symbolic rename is a "smart" Find-Replace, only changing the real target you specify. If the exact text of your target exists elsewhere, it's smart enough to ignore it.

    # re: Refactoring in VB.NET - Suggestions As Requested

    Tuesday, November 04, 2003 1:41 PM by Adam
    Extract Method: Take some lines of code and automatically create a method out of them.

    Extract Interface: Take some methods and automatically create an interface out of them.

    Encapsulate Field: Encapsulation is a key part of OO programming. This is just taking a field and creating a property around it automatically.

    # re: Refactoring in VB.NET - Suggestions As Requested

    Tuesday, November 04, 2003 1:48 PM by Cory Smith
    Ok, I'll add that symbolic renaming would be cool, since, I've been bit by the issue of find and replace changing words in comments when I didn't want it to.

    And thanks for the info on the other ones I wasn't sure about. Extract Interface I think is pretty important too. I would save quite a bit of work and fits hand in hand with the introduction in 2003 of VB.NET automatically creating the methods/properties when implementing an interface.

    Encapsulate Field... I guess that's what I was saying when I was wanting to turn member variables into properties. Yes... I really want this ;-)

    Extract Method... eh... not very high on my list. I think that this type of activity requires a bit more thought than select, click, do.

    As for the response about not being 'hip' and stating that I 'claimed ignorance'... if I'm not mistaken, I'm the first person to post a link to the site that was pointed out in amugst all of this discussion. It's just that I haven't spent any time learning about something that I currently can't really take advantage of. As someone who is knee deep in developing products that must be shipped yesterday... your right, I guess I can be as 'hip' as I'd like to be. However, I hope you can see that I'm willing to admit that I don't know the answer when the time is correct... besides, thanks to others, I now know what the other items on the list refer to. Thanks to those who provided that info (Tommy and Adam).

    # re: Refactoring in VB.NET - Suggestions As Requested

    Wednesday, October 27, 2004 10:12 PM by Ramon
    Extract method is probably THE most useful of all refactorings. The top two have to be extract method and rename. They let's you slice and dice code and fix bad names until the code is small, well factored, well named, and not redundant. It's sad that you don't even know what it is and so easily dismis it.

    # re: Refactoring in VB.NET - Suggestions As Requested

    Monday, June 13, 2005 12:16 AM by Hank
    I think Ramon had the priorities right:

    1. refactoring
    2. variable renaming (particularly in the case where variable names are part of generated member variables).

    But Ramon, "It's sad that you don't even know.."
    ?? give the guy a break. Don't disparage him for trying to learn and in the process make the product better.
    Anonymous comments are disabled