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 ...

Get Refactoring Workbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.