Clean Code: Classes and Data Structures

From SOLID principles, your code should be open to extension, and closed to modification.

As Uncle Bob points out, classes protect us from new types, while data structures protect us from new functions.

This means that when you suspect new functions may be required to implement in the future, wrap your data in a data structure. When a new function is required, you will add it without affecting the existing code.

Similarly, when you suspect new types may need to be supported by your current code in the future, make your objects instances of a class. When new types are required, you will define them as derivatives of the original class, and reimplement their behaviors as needed. This way you will avoid changing existing code while adding the new behavior.

Source: Clean Code Episode 5 - Form