Contrasting Data and Objects (2018)
3 days ago
- #data-structures
- #object-oriented
- #programming-languages
- The article discusses the fundamental distinction between data and objects in programming languages.
- Data is characterized by value equality, immutability, exposed internals, and extensibility through fixed variants.
- Objects are characterized by identity, mutability, encapsulation, and extensibility through fixed operations.
- Many languages fail to adequately support both paradigms, leading to poor design choices.
- Java exemplifies the 'everything is an object' extreme, lacking proper support for data.
- Haskell represents the functional extreme, excelling with algebraic datatypes but lacking in object representation.
- Scala and C++ attempt to combine paradigms but often result in complexity or confusion.
- Erlang is highlighted as a language that effectively separates data and objects, using processes for objects and rich data for communication.
- The NoSQL fad and REST's popularity are attributed to their ability to handle data effectively.
- The article advocates for conscious design choices between data and objects and calls for better language support for both paradigms.