July 15, 2010
Codemanship's Code Smell Of The Week - Data ClumpsWhen we see fields that always seem to be used together (e.g., passed together as mathod parameters, or used together in methods), this gives a strong indication that these fields really belong in their own class.
Jason Gorman (yes, that's me) illustrates how to refactor a data clump by extracting a class containing those fields and then moving the behaviour that accesses them into the new class.
Download the source code from http://bit.ly/c6nSIm
For training and coaching in refactoring, TDD and OO design, visit http://www.codemanship.com
Find out more about JUnitMax at http://www.junitmax.com
Posted 7 years, 11 months ago on July 15, 2010