Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 Extract method improvement for top-down guys

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
BruteForce Posted - Dec 12 2008 : 09:23:04 AM
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
1   L A T E S T    R E P L I E S    (Newest First)
accord Posted - Dec 12 2008 : 4:11:45 PM
We are considering doing this at some point:

case=2451

Great work with extract method

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000