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
 Move Implementation to Source needs own template
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

legalize
Tomato Guru

USA
119 Posts

Posted - Jun 19 2015 :  12:10:26 PM  Show Profile  Reply with Quote
Currently it shares a template with Create Implementation. Creating and moving are not the same thing, they should not be forced into the same template.

When I create an implementation for method XXX I want to have the implementation filled out with a stub implementation that forces me to implement it or decide to implement it explicitly as empty. Something like:
throw std::runtime_error("XXX not implemented");

When I move the implementation to the source file, I just want to move the implementation, not change it.

Forcing these two operations (any two operations, really) to share the same template is a bad idea. Each refactoring that is using a template should have its own unique template. You can always initialize them to the same template contents for backwards compatibility.

http://legalizeadulthood.wordpress.com

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Jun 19 2015 :  4:08:17 PM  Show Profile  Reply with Quote
We are planning to use the snippet "Create From Usage Method Body" as the default method body for Create Implementation as well:

case=81644
Go to Top of Page

jwiede
Junior Member

USA
12 Posts

Posted - Jun 24 2015 :  9:49:41 PM  Show Profile  Reply with Quote
Still can definitely see how it would be beneficial to have them use separate templates instead of sharing one. Sharing inherently limits.

Thanks!

-John W.
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Jun 28 2015 :  10:41:47 AM  Show Profile  Reply with Quote
Just to make we understand each other: both Create Implementation and Move Implementation would still use the same snippet but only Create Implementation would use "Create From Usage Method Body" as the method body, so essentially Create Implementation would use 2 snippets, while Move Implementation only one. This way, Create and Move Implementations would generate different results.

Do you still think we need different snippets?
Go to Top of Page

legalize
Tomato Guru

USA
119 Posts

Posted - Jun 29 2015 :  3:07:51 PM  Show Profile  Reply with Quote
Every individual refactoring needs it's own template.

When would I want to insert 'throw std::runtime_error(...)' when moving the implementation? Answer: never.

When would I want to insert 'throw std::runtime_error(...)' when creating an implementation? Answer: always. Because this helps me to remember that I *must* decide what the implementation should be.

Because these two are sharing a template, I can't use my device for helping me to make sure that I implement methods I've created, because every time VAX moves *any* method, it inserts the create method boilerplate.

Is there some expense in creating snippets? Even if they default to the same text, *everything* that invokes changes to my code should use a unique snippet.

Also, moving methods from the header to the source keeps reformatting my methods. I really wish you would stop doing that.

http://legalizeadulthood.wordpress.com
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Jul 01 2015 :  05:16:54 AM  Show Profile  Reply with Quote
The plan is that only Create Implementation will use the method body snippet, but NOT Move Implementation. Currently, "Create From Usage Method Body" is used by Create From Usage and Implement Interface. The default method body is:

throw std::logic_error("The method or operation is not implemented.");

This will used by Create Implementation but NOT by Move Implementation.

The question is that would you want to use different body for Create From Usage, Implement Interface and Create Implementation? The above snippet seems to be a good fit for all of them.

Create Implementation's snippet is as below:

$SymbolType$ $SymbolContext$($ParameterList$) $MethodQualifier$
{
	$end$$MethodBody$
}


Where you see $MethodBody$ is the place where Create From Usage and Implement Interface puts the method body snippet (the logic_error), but Create Implementation is not doing this, currently. So the plan is that Create Implementation will replace $MethodBody$ with the logic_error but Move Implementation will NOT do the same, since the $MethodBody$ is already given in case of Move Implementation.

Does this make sense?
Go to Top of Page

legalize
Tomato Guru

USA
119 Posts

Posted - Jul 01 2015 :  10:04:33 AM  Show Profile  Reply with Quote
Why would I want to use a different body for Create from Usage, Implement Interface and Create Implementation? Because freedom is good and coupling is bad.

There isn't any good reason these different actions should be coupled to the same template. Is there some expense in creating new templates? Give the user the freedom without being a cheapskate with the templates.

http://legalizeadulthood.wordpress.com
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Jul 02 2015 :  5:01:18 PM  Show Profile  Reply with Quote
Thank you for the explanation, I have put in a feature request for this:

case=90654
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