4 ms·
>> mixing of data and logic try lisp;) also in a language like java, where you can't upgrade a field to a property(function), these were placeholders, IF somed
by singularity2001 9y ago
>> mixing of data and logic
try lisp;)
also in a language like java, where you can't upgrade a field to a property(function), these were placeholders, IF someday you want to be smart about that field.
- ninkendo 9y ago> someday you want to be smart about the field That’s the part I don’t get. Why would you suddenly decide one day that a field needs to be smart? What’s the use case for an API that promised something is just dumb data and then suddenly isn’t any more? If you need encapsulation, you shouldn’t be pretending to the downstream consumers that you have “fields” at all. A good rule of thumb to me seems that if all you’re writing is getFoo/setFoo, you’re just a struct in disguise, and when you want to start making these things “smart” you need to rethink your API because the thing has fundamentally changed from data to logic, and pretending otherwise seems a really bad idea. I guess what I’m saying is there’s a real place for dumb data in programming. And complicated behavior happening behind the scenes of a dumb-data facade sounds like an anti-pattern to me.