Move Method: am I doing it wrong?

I'm refactoring a large legacy class in  ObjC++ which currently has about 250 methods. Most are tiny. For example, we have a bunch of accessors:

class Widget {
     ....
     virtual PColor     GetColor() const;
     virtual PColor     GetBorderColor() const;
     virtual PColor     GetShadowColor() const;
     ....
     };

I want to move these to a newly defined WidgetPainter

class WidgetPainter {
     ...
     virtual PColor     GetColor() const;
     virtual PColor     GetBorderColor() const;
     virtual PColor     GetShadowColor() const;
private:
     Widget *theWidget;
     };

a) Is this something Move Method can help me with?  Or have I got the wrong refactoring?
b) When I start Move Method, I see an empty modal dialogue with a preview and cancel button for about 45 sec, maybe longer. Is that right?
c) This is, I fancy, a fairly tricky refactoring to automate, though it's a very tedious one to do manually. Is this too ambitious to do?  Or does the problem lie in the size of the source class, which admittedly has gotten out of hand?  Or is it the size of the project, which now involves perhaps 200 classes?

0

Mark,
you are describing Extract Class refactoring - it moves finctions and variables to the new place, unfortunately it is not yet implemented in AppCode.
Nethereless, Extract Method is also suitable, if you don't have too many varibles associated with logic.

That you don't see enying in the extract dialog and that it takes so long to show up is a bug. Could you please first, take a CPU snaphot and file a performance problem in the tracker; second, try to isolate the problem with empty extract dialog in a sample project and file another bug report? We'll appreckiate you help very much.

0

请先登录再写评论。