This may be a very silly question--indeeed I am quite sure it is, but I'm
stumped nonetheless. I cannot find a way to refactor a class to a higher level in the hierarchy. To be clear: I have a (fragment of a) class hierarchy that looks like this: A | B | C which I would like to convert to: A / \ B C I thought "Refactor>Convert to Sibling.." applied to class C would do the job, but it does not work the way I thought it would. I would be grateful for any suggestions. Cheers, Stefano -- ______________________________________________________________ Stefano Franchi Department of Philosophy Ph: (979) 862-2211 University of Texas A&M Fax: (979) 845-0458 305B Bolton Hall [hidden email] College Station, TX 77843-4237 _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Why not just change the superclass of C?
Terry =========================================================== Terry Raymond Crafted Smalltalk 80 Lazywood Ln. Tiverton, RI 02878 (401) 624-4517 [hidden email] <http://www.craftedsmalltalk.com> =========================================================== > -----Original Message----- > From: [hidden email] [mailto:[hidden email]] On Behalf > Of Stefano Franchi > Sent: Thursday, March 20, 2008 3:24 PM > To: [hidden email] > Subject: [vwnc] How to move a subclass to a higher level in the > classhierarchy? > > This may be a very silly question--indeeed I am quite sure it is, but I'm > stumped nonetheless. I cannot find a way to refactor a class to a higher > level in the hierarchy. To be clear: > > I have a (fragment of a) class hierarchy that looks like this: > > A > | > B > | > C > > which I would like to convert to: > > A > / \ > B C > > I thought "Refactor>Convert to Sibling.." applied to class C would do the > job, > but it does not work the way I thought it would. > > I would be grateful for any suggestions. > > Cheers, > > Stefano > > -- > ______________________________________________________________ > Stefano Franchi > Department of Philosophy Ph: (979) 862-2211 > University of Texas A&M Fax: (979) 845-0458 > 305B Bolton Hall [hidden email] > College Station, TX 77843-4237 > > _______________________________________________ > vwnc mailing list > [hidden email] > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
In reply to this post by Stefano Franchi
On Thu, 20 Mar 2008 14:24:00 -0500
Stefano Franchi <[hidden email]> wrote: > I have a (fragment of a) class hierarchy that looks like this: > > A > | > B > | > C > > which I would like to convert to: > > A > / \ > B C > > I thought "Refactor>Convert to Sibling.." applied to class C would do the job, > but it does not work the way I thought it would. Refactor: Change the code while preserving behavior. How would you implement this requirement to meet your intention? Do you want to move only the methods defined in C or do you want to copy the methods and variables of B to preserve behavior? s. _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
You'd also have to inline super calls on C for which methods exist on B.
-Boris -- +1.604.689.0322 DeepCove Labs Ltd. 4th floor 595 Howe Street Vancouver, Canada V6C 2T5 http://tinyurl.com/r7uw4 [hidden email] CONFIDENTIALITY NOTICE This email is intended only for the persons named in the message header. Unless otherwise indicated, it contains information that is private and confidential. If you have received it in error, please notify the sender and delete the entire message including any attachments. Thank you. > -----Original Message----- > From: [hidden email] [mailto:[hidden email]] On Behalf > Of Stefan Schmiedl > Sent: Thursday, March 20, 2008 2:47 PM > To: [hidden email] > Subject: Re: [vwnc] How to move a subclass to a higher level in the class > hierarchy? > > On Thu, 20 Mar 2008 14:24:00 -0500 > Stefano Franchi <[hidden email]> wrote: > > > I have a (fragment of a) class hierarchy that looks like this: > > > > A > > | > > B > > | > > C > > > > which I would like to convert to: > > > > A > > / \ > > B C > > > > I thought "Refactor>Convert to Sibling.." applied to class C would > the job, > > but it does not work the way I thought it would. > > Refactor: Change the code while preserving behavior. > > How would you implement this requirement to meet your intention? > Do you want to move only the methods defined in C or do you > want to copy the methods and variables of B to preserve behavior? > > s. > _______________________________________________ > vwnc mailing list > [hidden email] > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
In reply to this post by Stefan Schmiedl
On Thursday 20 March 2008 16:46:42 Stefan Schmiedl wrote:
> On Thu, 20 Mar 2008 14:24:00 -0500 > > Stefano Franchi <[hidden email]> wrote: > > I have a (fragment of a) class hierarchy that looks like this: > > > > A > > > > B > > > > C > > > > which I would like to convert to: > > > > A > > / \ > > B C > > > > I thought "Refactor>Convert to Sibling.." applied to class C would do the > > job, but it does not work the way I thought it would. > > Refactor: Change the code while preserving behavior. > > How would you implement this requirement to meet your intention? > Do you want to move only the methods defined in C or do you > want to copy the methods and variables of B to preserve behavior? That's right--I was thinking of refactoring precisely along those lines--as preserving behavior. For methods in B inherited by C, I suppose there are two solutions: either move them to A or duplicate them in C. In this particular case I would prefer the latter alternative (because class B may eventually disappear). As there are also instance variables in B, we have the same alternative, although I am not so sure duplicating them is such a good idea. Cheers, S. > > s. > _______________________________________________ > vwnc mailing list > [hidden email] > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc -- ______________________________________________________________ Stefano Franchi Department of Philosophy Ph: (979) 862-2211 University of Texas A&M Fax: (979) 845-0458 305B Bolton Hall [hidden email] College Station, TX 77843-4237 _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Free forum by Nabble | Edit this page |