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
 Strange behavior of "Add Similar Member..."
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

mbobka
Ketchup Master

Russia
86 Posts

Posted - Jun 27 2006 :  10:31:19 AM  Show Profile  Reply with Quote
When is called dialog for editing of member signature is showed. But I'm not need editing member signature! I want to assign only name for new member.
Also, after creating declaration VAX creates implementation in .h, but is wrong, I want create implementation self (by "Create Implementation") or automatically in .cpp.

VAX 1524, VS 2005 & VS 2002

feline
Whole Tomato Software

United Kingdom
19021 Posts

Posted - Jun 27 2006 :  6:43:48 PM  Show Profile  Reply with Quote
this is by design.

the dialog is shown since we do not know what "similar" means. it may mean "same parameters, different name and return type", or it may mean "same return type, different name and parameters", or it may mean "different name, everything else the same"

the implementation is created in the .h to keep the refactoring operations simple. the idea is to avoid having to ask any more questions that required. the approach is to have lots of simple operations that the user can chain together however they want.

what ever default behaviour we choose will be wrong for someone *sigh* so the approach is to let you chain together as many, or as few, operations as you want.

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

mbobka
Ketchup Master

Russia
86 Posts

Posted - Jun 28 2006 :  04:10:01 AM  Show Profile  Reply with Quote
It's really bad design for me.

Becuase if I want to change return type or paramters I do it in IDE very well! But if I want to create a function with diffirent name, then you spend not few seconds but half of minute or even several minutes, while you will scroll throught kilometers of entire function signare (I have long signatures for functions which I want to "add similar" ).
I want to suggest not to remove entire signature, but select only function name text instead of entire signature in the text box.
Go to Top of Page

mbobka
Ketchup Master

Russia
86 Posts

Posted - Jun 28 2006 :  04:12:44 AM  Show Profile  Reply with Quote
About autoimplementation... Why function implemetation is in .h? Why not in .cpp? I still don't understand it.
Go to Top of Page

damned
New Member

Russia
9 Posts

Posted - Jun 28 2006 :  3:35:20 PM  Show Profile  Reply with Quote
What problem to have checkbox with meaning where create new member in the .h or in same .cpp as selected method?
I say 'same .cpp' because I have lots of methods in the class and want to group them in several .cpp files named with class name as prefix.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19021 Posts

Posted - Jun 28 2006 :  5:51:53 PM  Show Profile  Reply with Quote
quote:
Originally posted by mbobka

Becuase if I want to change return type or paramters I do it in IDE very well! But if I want to create a function with diffirent name, then you spend not few seconds but half of minute or even several minutes, while you will scroll throught kilometers of entire function signare


if you use this dialog to change the return type then both the header and the cpp file are modified for you, so less work.

in the dialog press the HOME key, to get to the beginning instantly. you can then use CTRL + Left Arrow to jump one word at a time to the function name.

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

feline
Whole Tomato Software

United Kingdom
19021 Posts

Posted - Jun 28 2006 :  5:57:04 PM  Show Profile  Reply with Quote
the basic reason for placing the new implementation in the .h file is to only modify one file. if refactoring modifies multiple files it gets confusing to watch, and to implement.

the basic idea is to have lots of very small, very simple operations, with the absolute minimum of questions and user interaction. short of asking all the time what the user wants we can never satisfy everyone, so there are small simple refactorings, and you can chain them together in the way that best suits you.

it does take a change in the way you think and work to get the most out of VA refactoring, something i am still working on myself, but it does save me a lot of typing and work.

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

support
Whole Tomato Software

5566 Posts

Posted - Jun 28 2006 :  10:51:25 PM  Show Profile  Reply with Quote
Learn how to use Create Implementation effectively by reading the documentation available via:

www.wholetomato.com/products/matrixRefactoring.html
Go to Top of Page

mbobka
Ketchup Master

Russia
86 Posts

Posted - Jun 29 2006 :  04:19:38 AM  Show Profile  Reply with Quote
I think AutoText template needed for "Add Similar Member"...
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19021 Posts

Posted - Jul 01 2006 :  12:09:25 PM  Show Profile  Reply with Quote
what are you hoping to do with an autotext entry? the function name and parameters are available for you to edit in the dialog box, and this refactoring is only designed to insert an empty function body.

it could be you are looking for a different operation than add similar member.

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

mbobka
Ketchup Master

Russia
86 Posts

Posted - Jul 02 2006 :  06:00:45 AM  Show Profile  Reply with Quote
I don't need autoimplementation in header file for added member. Also, coding standards may vary for different developers, and declaration "in one row" may be unacceptable.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19021 Posts

Posted - Jul 02 2006 :  2:06:36 PM  Show Profile  Reply with Quote
i don't follow.

with add similar member we have two options. we always put the new member "somewhere", or we ask the user what to do every time they trigger this refactoring. asking can quickly lead to more options, etc. even if we ask the user if they want the function placed in the header or the cpp file having an autotext entry is not going to make a difference.

the purpose of add similar member is to help when you are making a small change to an existing method or variable. i find it is most useful when i am sitting in a cpp file *using* a class, and decide that i need to modify the class i am using. i can then trigger this refacoring on the existing class member variable, which is a lot easier than navigating to the class header file and manually adding the new line.

as soon as we have any behaviour in VA, someone somewhere wants it to work differently. refactoring is just a very obvious example of this effect.

the design is to have refactoring operations that are very small and well defined, so they do not need options, and do not need to ask the user questions. "move implementation to cpp" exists specifically to help in cases such as this, so after using add similar you can move the new function to the cpp file.

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

mbobka
Ketchup Master

Russia
86 Posts

Posted - Jul 02 2006 :  4:46:18 PM  Show Profile  Reply with Quote
new member "somewhere" may be invalid:

class A {
   int F() {}   // <-- invalid. have no return value
};

therefore no reason for creating it...

just sample. i assume that refactor must create valid code (compilable)
Go to Top of Page

Sasa
Tomato Guru

272 Posts

Posted - Jul 02 2006 :  7:04:30 PM  Show Profile  Reply with Quote
mbobka: I would rather see it not compile. What if the code produced is

class A {
int F() {return 1;}
};

Then the code will compile but you might forget toactuall correct the code and make it return something that has to do with logic instead of just plain 1. What if "1" is an error code in F()? the calling function will fail because it thinks there is an error code, etc...

I think the current behavior is just fine for that functionality.

C++
Visual Studio 2008 Pro
Windows 7 x64
Go to Top of Page

mbobka
Ketchup Master

Russia
86 Posts

Posted - Jul 03 2006 :  02:39:57 AM  Show Profile  Reply with Quote

class B {
public:
    B( int );
    B( float );
    B( B const& );
};

class A {
   B F() {}
};

How about this? It's correct? Which constructor to choose?

class B {
private:
    B();
    B( B const& );

public:
    static B& GetInstance();
};

class A {
   B& F() {}
};


And here?

And I just no need in junk code! I don't want it! Why I must do something to remove it? Why AutoText is not an option?

Edited by - mbobka on Jul 03 2006 02:42:23 AM
Go to Top of Page

mbobka
Ketchup Master

Russia
86 Posts

Posted - Jul 03 2006 :  02:43:23 AM  Show Profile  Reply with Quote
Linker will notify me which functions is not implemented.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19021 Posts

Posted - Jul 04 2006 :  6:34:23 PM  Show Profile  Reply with Quote
the design behind "add similar member" is to produce an empty "stub" of a function, that you can them move to the cpp file if you prefer.

i expect people to use this refactoring when they are ready to produce the body of the function.

if what you want is to copy / paste an existing line in the header file, and make a small change to the parameter list then is it not quicker to actually just do this?

i am wondering if you are looking for something slightly different that the operation "add similar member" was designed for.

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

mbobka
Ketchup Master

Russia
86 Posts

Posted - Jul 05 2006 :  01:00:38 AM  Show Profile  Reply with Quote
I can add similar member from other class, Copy-Paste for it will be slow option (find source code, copy, find target place, paste, return to place where I was before, compare it with two clicks...), I want do it fast, but junk code inserted after declaration slows me down. And I have no option to remove it.
Go to Top of Page

jpizzi
Tomato Guru

USA
642 Posts

Posted - Jul 05 2006 :  02:04:51 AM  Show Profile  Reply with Quote
mbobka: I am reading this thread, and can't seem to understand what it is you are asking for.

Your first comment was that the dialog wasn't needed for you and you mention that creating the implementation in the header was wrong for you.

We explained that "similar" is too vague a word, and that at different times you may want it to mean different things. Therefore, we display the dialog box. Your description seems to indicate that you want to use this feature to create a new method with the same parameter list. We told you how you could accomplish this with the dialog as we implemented it (the CTRL-Home, then CTRL-Right arrow to move by words).

The creation of the implementation in the header file is not ideal in most situations, but that is one reason we came up with the "move implementation to source file." feline's response gave the reason for not just changing it to automatically place it in the source file to begin with.

In your last post, you mention being able to add a similar member from another class. What do you mean by this? How does it relate to the ongoing discussion?

I'm lost.

Joe Pizzi
Go to Top of Page

mbobka
Ketchup Master

Russia
86 Posts

Posted - Jul 05 2006 :  04:23:53 AM  Show Profile  Reply with Quote
jpizzi:
1. Dialog selects entire text -- it's bad. Why not only function name?
2. Strange (for me) implementation in header -- also bad for me. I think AutoText should fix it for me.
Go to Top of Page

jpizzi
Tomato Guru

USA
642 Posts

Posted - Jul 05 2006 :  10:31:50 PM  Show Profile  Reply with Quote
mbobka:
1. We think it common for someone to want to add a "Similar Method" that changed the parameters instead of the function name (e.g., a overloaded method). Your way of doing it would not work for those times.
2. Placing the implementation in the header is just an expedient way to not edit multiple files unless explicitly asked to do so (via "Move implementation to source file" or "Rename variable/function." or the like)

Joe Pizzi
Go to Top of Page

mbobka
Ketchup Master

Russia
86 Posts

Posted - Jul 06 2006 :  01:43:03 AM  Show Profile  Reply with Quote
Eh...
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19021 Posts

Posted - Jul 06 2006 :  6:04:19 PM  Show Profile  Reply with Quote
there is a lot of confusion here

mbobka can you explain a real world example of what you want to do? maybe things will make more sense then.

if "add similar" simply adds the declaration, with no curly brackets (which seems to be what you want) then you will have invalid code that can never compile once you call the new function. you will get a linker error, but this will not take you to the source of the problem.

by inserting an empty body (in the header file) VA increases the odds of the code compiling, and if it is invalid at least you are taken to the source of the problem by the compiler error, e.g. nothing is being returned.

zen is the art of being at one with the two'ness
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