[Tutor] Refactoring

Kent Johnson kent37 at tds.net
Sun Nov 27 13:57:00 CET 2005


Alan Gauld wrote:

> Picking up Kent's message about refactoring, my approach tends to
> mean I more often refactor by combining classes into a higher level one,
> or reverting a class to a native data type than I do by breaking a class
> into smaller pieces. Most folks tend to mean the opposite direction
> when they say refactor - breaking a class or method out into two.

Hmm, refactoring is so much more than that. Common refactorings for me are extracting common code to a new function or method, moving an attribute or method from one class to another, changing a functional interface to an object-based one, changing the signature of a method, extracting a base class (OK, I do use base classes sometimes ;)

There is a catalog of refactorings here:
http://www.refactoring.com/catalog/index.html
and I recommend Martin Fowler's book to anyone who hasn't read it:
http://martinfowler.com/books.html#refactoring

Kent



More information about the Tutor mailing list