When I am working with code that is not object oriented I often see a bunch of objects that just contain data and not much behavior. These methods are often passed to helper classes that perform the real work.
Class MyHelperClass
{
public static void DoSomething(MyObject thing)
{
Dothis(thing.This);
Dothat(thing.That);
DoTheother(thing.Other):
}
}
Whenever I see static helper functions I look at the parameter list for objects that would be a better home for the function.
This specific instance of the Move Method refactoring is kind of the reverse of the Foreign Method refactoring. So my name for this refactoring is "Move Foreign Method to Server Class"
Monday, October 22, 2007
Subscribe to:
Post Comments (Atom)
1 comment:
Nice clear and simple example. When are you planning to write your own refactoring book?
Post a Comment