3 ms·
Isn't that what OOP is? Methods contain code, objects contain code and data, and invocations of code are primarily in reference to data.
by tenebrisalietum 3y ago
Isn't that what OOP is? Methods contain code, objects contain code and data, and invocations of code are primarily in reference to data.
- WinLychee 3y agoWell, in Clojure at least, data is a generic thing you structure your program around, and is not hidden inside a class coupled to behavior. This is safely enabled by immutable values as a default. The standard library and ecosystem consists of generic functions operating on that immutable data. This is very liberating as you do not run into a combinatorial explosion of incompatible types that need to be marshaled to work together. Generally you have 3 kinds of things in Clojure: associations (maps), sets (uniqueness), and order (lists/vectors).
- otter-in-a-suit 3y agoI think you’re describing FP in general here. I, too, am a fan, especially in data intense applications, where a clear / decoupled data model and aggressive compiler solve many headaches.
- lmm 3y agoI'd say the opposite - OOP is the paradigm that does the most to hide your data, hiding it within these encapsulated actors where you can't access it directly or even see what and where you have.
- kendalf89 3y agoI would have thought that encapsulation hides the way data is processed, stored, and moved around. But the data itself is always available in my experience.
- lmm 3y agoSuppose the data is in a private field of an object deep in the object graph. How do you get it? You can't, by design - that object's public interface may expose some aspects of the data, but you're not meant to access the actual raw data.