Author |
Topic |
|
BruteForce
Senior Member
Greece
32 Posts |
Posted - Nov 06 2006 : 08:58:30 AM
|
Hi,
I am using extract method quite often and it does fairly well. I would like a simple improvement. VA should let me control the order of parameters. This can be done with a simple grid and a pair of up-down buttons.
Ideally the grid should have 3 columns: Order, Variable, New Name. I always prefix my function arguments with a_ (obviously from argument) so an extra column for the final name of the parameter would be just handy and I believe trivial to implement since you already support rename-variable.
Warm Regards, Dimitris Staikos |
When all else fails try common sense. |
|
feline
Whole Tomato Software
United Kingdom
19020 Posts |
Posted - Nov 06 2006 : 09:04:00 AM
|
The solution here is to run Extract Method first and then Change Signature on the new function. We have taken the design decision to ask the absolute minimum number of questions during refactoring operations. So all of the refactoring operations are designed to be very "basic", and well suited to being chained together.
Otherwise you end up in the position of having to ask the user 67 questions in a massive wizard every time they want to do something, in order to accommodate all of the different things people want to do
http://www.wholetomato.com/products/features/changeSignature.asp |
zen is the art of being at one with the two'ness |
|
|
BruteForce
Senior Member
Greece
32 Posts |
Posted - Nov 06 2006 : 09:45:09 AM
|
Thanks for the response, I didn't know that I could reorder the parameters with Change Signature. I trust it reorders the parameters in all calls to the function as well.
I understand your design decision. It's KISS. However allow me to disagree on one thing. An extract method dialog with one or two options to allow reordering the parameters and a checkbox to optionally show an added column with new names for the parameters would be far simpler and straight-forward and possibly less error-prone for the user than dealing with 3 dialogs to run 3 separate refactorings.
It all depends on what you fundamentally define as "extract method". Currently you seem to define "extract method" as "Extract a piece of code into a function whose arguments are in semi-random order and have the same names as the local variables in the original piece of code". For all I know this is what VA does.
I'd rather you defined "extract method" as "Extract a piece of code into a function whose argument names and order are controlled by the user". Personally this is the feature I need.
Warm Regards, Dimitris Staikos |
When all else fails try common sense. |
|
|
feline
Whole Tomato Software
United Kingdom
19020 Posts |
Posted - Nov 06 2006 : 1:20:11 PM
|
You make a very valid argument I cannot just agree with every suggestion that is posted, and sometimes it is hard to be sure where to draw the line. I have put in a feature request for this, especially since if done carefully the dialog can be used as before, just enter the method name and press Enter to accept.
case=3462
Change Signature does not change all of the calls. If you think about default parameters, and other edge cases, this is not as easy as it sounds. |
zen is the art of being at one with the two'ness |
|
|
BruteForce
Senior Member
Greece
32 Posts |
Posted - Nov 07 2006 : 08:50:39 AM
|
Thanks Feline!
If everyone else in Whole Tomato is as open minded as you then it's no wonder why VA rocks :-)
Warm Regards, Dimitris Staikos |
When all else fails try common sense. |
|
|
feline
Whole Tomato Software
United Kingdom
19020 Posts |
Posted - Nov 07 2006 : 11:35:11 AM
|
We do try
On a related front, if you have a solid argument for something it is always worth making your case, since we can be talked round, at least some of the time |
zen is the art of being at one with the two'ness |
|
|
|
Topic |
|