Classes vs. Data Structures
5.4 Key Insight: Objects and data structures are not interchangeable but complementary opposites, and understanding this distinction is essential for making informed design decisions about extensibility, dependencies, and system architecture.
Uncle Bob distinguishes between objects and data structures as complementary opposites: objects are functions operating on implied data, while data structures are data operated upon by implied functions. This distinction has profound implications for software design, particularly regarding ORMs (which transfer data between structures, not map to objects), the object/relational impedance mismatch, and how we add types versus functions. The post demonstrates that classes make adding new types easy but functions hard, while data structures make adding functions easy but types hard. Additionally, data structures create source code dependencies that flow toward implementations (causing widespread recompilation), while classes invert these dependencies, isolating callers from changes.
8 There is no such thing as an Object Relational Mapper; because there is no mapping between database tables and objects.
7 There is no impedance mismatch because objects and data structures are complementary, not isomorphic.
6 Objects are the opposite of data structures.
Clean CodeSOLID Principles