Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Feature Requests
 Extract method improvement for top-down guys
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

BruteForce
Senior Member

Greece
32 Posts

Posted - Dec 12 2008 :  09:23:04 AM  Show Profile  Reply with Quote
Quite often I get into top-down programming mode, that is I write the code calling functions that don't exist yet, until I get my logic laid out ok, then go to implement the "helpers".

So I had in my code a call like this:

    PrepareRequests(RequestArray, 
                    BufferArray, 
                    uRequests, 
                    uRequestsPerFrame, 
                    uMaxPacketsPerIsoRequest, 
                    uRequestsWithMaxPackets);


I right clicked on the function name in the hope that VA would help me save some time by creating the function for me, but no luck; no refactorings were available on this name.
Then I selected the whole call and was happy to see that "Extract Method" was available. I imagined what would happen and indeed it played out exactly as such.

I gave the "new" function the same name (which was the intended name for me) and after clicking OK I got a new function created with a recursive call to itself and my original call stayed the same modulo the formatting... (I hated that).
It got all the parameter types perfectly (since all variables were declared properly) and it kept the exact same parameter order, which was *almost* perfect.

The three minor things that prevented perfection were:
(1) The function body got created in the header file (?!?!) that corresponded to the CPP file I was working on.
(2) The formatting in the initial call was converted to a one-liner call extending offscreen to column 2938435 (did I say I hate that?)
(3) The recursive call that I had to delete.

I don't know if correctly "creating function bodies for unknown functions based on a function call signature" is a refactoring you could consider adding, even as a variation to extract method, but it would be nice to have.

Warm Regards,
Dimitris Staikos

When all else fails try common sense.

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Dec 12 2008 :  4:11:45 PM  Show Profile  Reply with Quote
We are considering doing this at some point:

case=2451

Great work with extract method
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000