Code and Design Refactoring is any change to a computer systems' code or design which improves its readability or simplifies its structure without changing its results.

Here we illustrate refactoring techniques which are applicable to Groovy. In general, most Java refactoring techniques apply equally well to Groovy. Sometimes Groovy adds a new twist as well.

We don't discuss tool support to auto implement some of these refactoring techniques. Consult your IDE plugin documentation to see if it has any specific support that you can use.

Refactoring Techniques

References

  1. Martin Fowler (1999). Refactoring: Improving the Design of Existing Code. Addison-Wesley. ISBN 0-201-48567-2.
  2. Joshua Kerievsky (2004). Refactoring To Patterns. Addison-Wesley. ISBN 0-321-21335-1.
  3. Michael Feathers (2005). Working Effectively with Legacy Code. Prentice Hall. ISBN 0-13-117705-2.
  4. Dierk Koenig with Andrew Glover, Paul King, Guillaume Laforge and Jon Skeet (2007). Groovy in Action. Manning. ISBN 1-932394-84-2. Discusses the importance of having tests in place before refactoring.

See also: Design Patterns with Groovy