Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 Creating New Member functions in C++

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
accord Posted - Jan 05 2008 : 3:33:02 PM
I am plan to write about "where new functions should be created: cpp or header". I know, we have discussed this countless before, but I feel this is an important question.

I know, I know, you don't want to ask more questions. I think that, the very ideal solution will be, if Extract Function and Add similar Member will simply create the new function to the same file. So if I start extract function from cpp, VAX will place the new function into the cpp. If I start from the header, VAX will place the new function into the header.

In rare cases when this is not sufficient, one can use "Move implementation to source" or "Move Implementation to Header File" (case=10239)

This will solve most of the problems, including that we almost always have to use move implementation to source after extract function or Add similar Member.
quote:
MrJones4u said: Well maybe I'm "old school", but I never (well very, very rarely) implement functions in the class definition. So I'm constantly doing "Move Implementation to source file" after using e.g. "Add similar Member".
http://forum.wholetomato.com/forum/topic.asp?TOPIC_ID=6999

quote:
RobG said: It is rather rare that I want the new method as inline code in the .h file.
http://forum.wholetomato.com/forum/topic.asp?TOPIC_ID=6215&SearchTerms=move,implementation,to,header

Feline said in this thread also: First the question of placement of the extracted function - header or cpp file. We are discussing this internally at the moment, trying to find a good general solution.

What do you think about my suggestion for this "general" solution?
I feel this solution can be a great improvement, without the need of adding new options
6   L A T E S T    R E P L I E S    (Newest First)
support Posted - Jul 14 2008 : 4:07:01 PM
case=11206 is implemented in build 1645 for Extract Method.

case=18473 will address this feature for Add Similar Member.
feline Posted - Jan 08 2008 : 5:51:31 PM
*ah*

I see what you mean, but this does rather complicate matters. At the very basic level, VA needs to decide on a "sensible" position for the new entry in both the header and the cpp files.

I have put a note on the case about this.
accord Posted - Jan 08 2008 : 3:06:34 PM
My motivation to extract the method into the cpp rather than into the header was that I would like to see my extracted function under the original one. This is how extract method working for header: it puts new method under the original. So, calling simply "Move Implementation to Source File" is not enought. But VAX is know what was the original method, so can put the extracted one under it (maybe as a parameter in the internal call of move implementation to source)

(...or maybe: what about if VAX will remember last Extract Method, and if I using "Move Implementation to Source File" on this extracted method it will automatically put under the original one. In this case chaining will do the job.)

Sorry, I really do not want to complicate things, but in a larger file it is very time confusing to find the original method in VA Outline, and then drag my extracted method under it (after move implementation to source). In most of the time it is faster to do extract method by hand, especially for "void MethodName(void)" methods.
feline Posted - Jan 08 2008 : 1:52:03 PM
I have put in a feature request for this to see what the developers make of it. On paper this is quite appealing, and technically it can be viewed as just chaining together two existing refactoring operations. It almost sounds doable when put like that

case=11206
accord Posted - Jan 07 2008 : 4:02:28 PM
quote:
I suspect the original decision was "technical". It is "easier" to place a new C++ class member function into the header file

Understand. But I am talking about future improvements.

quote:
I am wary of merging the two commands together

So, implement it carefully
You are continuously improving VAX, so it was a suggestion, what I would like to see in a later version. I understand that every new feature has overhead on your side. Refactoring is a quite powerful feature, so I would like to see improvements to it.
feline Posted - Jan 07 2008 : 2:56:42 PM
My first reaction is that this sounds to easy, there has got to be an obvious problem with this

I suspect the original decision was "technical". It is "easier" to place a new C++ class member function into the header file, and into the class declaration than it is to place it into the cpp file. This then localises all of the "how do I do that in the cpp file" into one command, Move Implementation to Source File.

Purely from a support perspective I am wary of merging the two commands together, since I already have "fun" with the subtle bugs each command (Move Implementation to Source File and Extract Method) has.

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