Also described on page 142 of MartinFowler's RefactoringImprovingTheDesignOfExistingCode:
While ReFactor-ing, you discover a method that is very tightly bound to another class, but not to its own.
Therefore, move the method.
Example.
View>>... .... area := bounds bottom - bounds top * (bounds right - bounds left). ....becomes:
Rectangle>>area ^self bottom - self top * (self right . self left)You may be able to use this refactoring any time you see two or more messages in a single method going to an object other than self.View>>... .... area := bounds area. ....
What do you do when you'd like to MoveMethod or MoveField, but you are not able to change the desired destination class because it is in SomebodyElsesFramework, or due to restrictive configuration management policies? See ForeignMethod and IntroduceLocalExtension.
This page mirrored in WikiPagesAboutRefactoring as of July 17, 2004