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
 Technical Support
 Change Signature
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Mike ONeill
Tomato Guru

South Africa
103 Posts

Posted - Jun 23 2011 :  04:33:08 AM  Show Profile  Reply with Quote
Am I expecting too much ?

When I use Change Signature , to add a new Parameter into a method , should it update all references to the method

It doesn't seem to

This VS2010 C# VAX 1850

eg private int Test(int anyNumber, int multiplier)
{
return anyNumber * 20;
}

private void UseTest()
{
int z = Test(10);
}

Cheers

Mike

feline
Whole Tomato Software

United Kingdom
18750 Posts

Posted - Jun 23 2011 :  09:44:05 AM  Show Profile  Reply with Quote
In your example, what would you like VA to do? It is not obvious to me what VA could sensibly do here.

When you run Change Signature and VA detects a change to the parameters, you should get a message box telling you this, and VA triggers a Find References on the function call, to help you locate all of the calls that need to be updated.

zen is the art of being at one with the two'ness
Go to Top of Page

Mike ONeill
Tomato Guru

South Africa
103 Posts

Posted - Jun 23 2011 :  11:25:55 AM  Show Profile  Reply with Quote
Sorry maybe not as clear as it could be ...

I set up Test with One Parameter and then used it in the second method.

I now did Refactor Change Signature on Test to add the second parameter (int multipler) , expecting where I called Test to add the second parameter in the Method Call [int z = Test(10, <>)] as say a default 0 value, but it didn't

It did as you say show me where I should make the changes by showing Find Reference.

I tried it to see how it worked, as I wanted to add a new Parameter to a Method I have used hundreds of times already . Its an Exception Manager with 2 Parameters I wanted add "Show Message" bool as a third

In this case it changed the Method and showed me hundreds of places I need to adjust , Not too helpful I am afraid .

Is this the designed behavior

Mike
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18750 Posts

Posted - Jun 23 2011 :  5:02:26 PM  Show Profile  Reply with Quote
I am not sure I understand. I think you started with this:

private int Test(int anyNumber)
{
	return anyNumber * 20;
}

private void UseTest()
{
	int z = Test(10);
}


ran Change Signature to get:

private int Test(int anyNumber, int multiplier)
{
	return anyNumber * 20;
}

private void UseTest()
{
	int z = Test(10);
}


but wanted:

private int Test(int anyNumber, int multiplier)
{
	return anyNumber * 20;
}

private void UseTest()
{
	int z = Test(10, 0);
}


is this correct? To have VA automatically add a dummy parameter to each of the function calls that need to be updated?

zen is the art of being at one with the two'ness
Go to Top of Page

Mike ONeill
Tomato Guru

South Africa
103 Posts

Posted - Jun 26 2011 :  04:15:52 AM  Show Profile  Reply with Quote
Spot On

What I wanted is as you say a dummy parameter added to each call to that method , after refactoring .

If you look at how other Refactor tools deal with this , this is what they give .

For example R# gives you an option of

a) Not adding ,
b) adding 0 in the case of an int or to
c) add a specified integer .

And similar with other variable types.

On the face of it VAX , adjusts the method itself , but does not adjust any calls to that method , simply showing you where you need to go to adjust them manually .

This is fine if its a few calls but in my initial requirement , it was adjusting a method I had used repeatedly , so the number of manual adjustments was horrendous , maybe even hundreds. I actually used R# to do it and it was done in seconds.

Mike
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18750 Posts

Posted - Jun 27 2011 :  10:10:02 AM  Show Profile  Reply with Quote
This is an interesting idea, but I am not quite sure what to make of it. When you are dealing with a simple type, a default parameter is fairly easy to define. But what about more complex types? Class types? Pointers? References?

The other basic question is what are you trying to achieve. Obviously in this case a "default" parameter was acceptable in all cases, but I am wondering how common this is. Because I come from a C++ background in this situation I would just add a new parameter with a default value, so I would only have to add the parameter to function calls where I needed something other than the default value.

zen is the art of being at one with the two'ness
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18750 Posts

Posted - Jun 27 2011 :  3:12:21 PM  Show Profile  Reply with Quote
I have now had a look at how this works in ReSharper, and it is an interesting idea, especially since I now see how optional it is, and easy to ignore if not wanted.

We are trying to keep our refactoring dialogs more streamlined, but something could be done to help here. So I have put in a feature request to see what our developers make of it:

case=58410

zen is the art of being at one with the two'ness
Go to Top of Page

sean
Whole Tomato Software

USA
2817 Posts

Posted - Feb 26 2014 :  10:37:38 AM  Show Profile  Reply with Quote
case=58410 is implemented in build 2029
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