Results 1 to 2 of 2

Thread: Rename refactoring

  1. #1
    Join Date
    Feb 2009
    Location
    Stord, Norway
    Posts
    882

    Default Rename refactoring

    I'm starting a new thread, to follow up on Stephen's suggestion

    Quote Originally Posted by Stephen W. Meeley View Post
    Hi Ola,

    I'm fairly sure that better refactoring support is on the big list of possible improvements, but it never hurts to log specific suggestions. Is there a particular tool that you think does renaming well? If so (or even if not), you may want to float a scenario here in the forums (I'd start a new thread), get feedback and then log the result.
    According to Martin Fowler, "Refactoring is a disciplined technique for restructuring an existing body of code, altering its internal structure without changing its external behavior." So the goal is to improve the structure of a program, but maintain the behavior.

    There are several refactorings listed, but I would like to start with one: Rename.

    Glancing to Visual Studio's C# Rename Refactoring, we find that there are in fact many rename operations. Resharper seems to be a great refactoring tool, also. Translating to VDF, I can think of the following:
    • Rename property
    • Rename local variable
    • Rename global variable
    • Rename local method
    • Rename global variable
    • Rename file
    • Rename class
    • Rename object
    • Rename struct
    • Rename constant
    Did I forget anything?

    So, just as we can right-click on a word in VDF Studio and select "go to definition", it should be possible to select "rename".

    The rename operation should then rename all relevant occurrences of the selected term. This is the tricky part, where we manually have to search/replace in files. Normally, we need to manually check every occurrence to determine if it needs to be renamed or not. A simple search/replace routine does not "know enough" to decide this. But an intelligent rename refactoring feature would know more, thus reducing the need for manual labor. The ideal situation is when the Studio can do the renaming fully automated, but I believe this will not be feasible (or even possible?) in all cases. In this case, a list of suggested renames should be presented, allowing for manual verification.

    I would suggest "start small", that is, pick the "low hanging fruit" where a feature is easy to implement, yet gives great benefits. "Rename local variable", "Rename global variable", "Rename global method", "Rename constant", and "Rename file" should be easy to fix. "Rename class" shouldn't be too hard, either (just remember to account for U_ and RefClass).

    Your thoughts are welcome!
    Last edited by Ola Eldoy; 27-Mar-2012 at 04:26 AM.
    Ola Eldøy (Twitter: @olaeld) - Developer at Emma EDB AS

  2. #2
    Join Date
    Feb 2009
    Location
    New Prague, Minnesota USA
    Posts
    1,130

    Default Re: Rename refactoring

    An obvious and pertinent example is changing table and column names, now that 17.0 allows for longer names.
    Larry R Pint
    SOFT-STAR, Inc.
    New Prague, MN

    "What is that unforgettable line?” Samuel Beckett

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •