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
 Feature Requests
 Refactor to Interface
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

John_H_Bergman
Tomato Guru

USA
198 Posts

Posted - Jul 26 2006 :  1:20:02 PM  Show Profile  Reply with Quote

I'd like to refactor a specific method to an interface, if te object implements more than one interface, it should ask which one to put it in. (refactor on the method/property)

It'd be nice if I could take all the public methods/properties of an object and refactor it into an interface. (refactor on the class name)

John H. Bergman
CTO
SiliconZone


[email protected]

To Send email, remove the .online.

feline
Whole Tomato Software

United Kingdom
18939 Posts

Posted - Jul 29 2006 :  10:22:08 AM  Show Profile  Reply with Quote
*um*

are you talking about getting VA to modify a base class from an instance of the derived class? this has been discussed on the forum in broad terms, and the idea is interesting, but runs into difficulties with multiple inheritance, etc.

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

John_H_Bergman
Tomato Guru

USA
198 Posts

Posted - Jul 31 2006 :  4:30:04 PM  Show Profile  Reply with Quote
No, I am asking about refactoring to an interface in c#, although the baseclass idea would be useful too :-)

John H. Bergman
CTO
SiliconZone


[email protected]

To Send email, remove the .online.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18939 Posts

Posted - Jul 31 2006 :  5:22:36 PM  Show Profile  Reply with Quote
i have the feeling i don't quite follow what you are asking for here. i never really studied interfaces in C#, but i think i understand the basic idea.

if you have the class:

class Foo : public IFeline
{
public:
    void bar();
}


(i have guessed at the syntax for interface, for ease )

you want to say "add bar to the interface"?
or are you after something else?

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

obricker
New Member

USA
7 Posts

Posted - Aug 03 2006 :  11:21:06 AM  Show Profile  Reply with Quote
Having VA " add Bar to the Interface" (IFeline in this case) in this way seems a lot like Push Up Method. It would just replace the parent implementation with a declaration that the method is abstract and leave the current implementaion in place.

I would like the option of "Create Interface" which would present me with the methods first defined by the target class and let me choose which one to take. Then a class would be created with these methods as abstract. The original class would then inherit from this Interface class. Easy, right?

OB

Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18939 Posts

Posted - Aug 03 2006 :  6:57:55 PM  Show Profile  Reply with Quote
push up method has been discussed on the forum, and we thought up various situations where it could be tricky.

creating a whole new interface like that... it is an interesting idea, but it certainly sounds more complex and involved than push up method. "easy" is not a word i would use personally!

*considers*

once the interface, or parent class (since the idea is the same) has been created all you are really talking about is some form of push up method run multiple times.

for now we probably need to wait and see what happens about push up method. currently we are working on fixing as many of the outstanding bugs as possible, both in the new refactoring code, and other, more general bugs.

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

obricker
New Member

USA
7 Posts

Posted - Aug 12 2006 :  5:20:14 PM  Show Profile  Reply with Quote
I was thinking that it would be easy once push up method was implemented.

I would have put a smiley on the comment buit they are
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18939 Posts

Posted - Aug 13 2006 :  1:14:12 PM  Show Profile  Reply with Quote
once push up and push down appear (assuming they ever appear) i am sure creating interfaces will come up again. it is possible we will decide against this specific idea, but instead make the building blocks available. this is the general design behind the current refactoring code, to provide small and well defined operations that can be chained together by the user to create the desired result.

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

John_H_Bergman
Tomato Guru

USA
198 Posts

Posted - Aug 18 2006 :  10:56:08 AM  Show Profile  Reply with Quote
The only trick with push-up into an interface is that you would have to remove the public and all of the method body.

using your example

class Foo : BaseBar, IFeline
{
/// <summary>
/// Some meaningful description
/// </summary>
public void bar()
{
// Do some C# stuff
}
}


would be
public interface IFeline
{
/// <summary>
/// Some meaningful description
/// </summary>
void bar();
}

or, if you wanted to carry this further and push it up as an abstract method (also useful)

public class BaseBar
/// <summary>
/// Some meaningful description
/// </summary>
public abstract void bar();

}


Then of course, you could push up the whole method. and remove it from the source class.

So in my mind, there are really 3 options

Push up to interface
Push up as abstract method
Push up with implementation

John H. Bergman
CTO
SiliconZone


[email protected]

To Send email, remove the .online.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18939 Posts

Posted - Aug 19 2006 :  09:04:10 AM  Show Profile  Reply with Quote
i have found a case mentioning push up, so i have mentioned this thread there, so hopefully we won't loose track of this.

case=1121

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