O'Reilly logo

Refactoring Workbook by William C. Wake

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 8. Data

Data can be defined as simple facts, divorced from information about what to do with them. “Data” has a dusty whiff about it, the old-fashioned ring of data processing or data structures.

Data is often a natural starting point for thinking about things. For example, we know we have a first name, middle name, and last name, so we create a Person class with that information. But objects are about data and behavior together—your code will be more robust if you organize objects by behavior.

Data-oriented objects are an opportunity. The smells in this chapter are often signs of a missing or inadequately formed class. If the data represents a good clustering, we'll usually be able to find behavior that belongs in the class.

Smells Covered ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required