4 ms·
IMO, when people talk about OOP they aren't talking about bags of static functions -- that's just a namespace. The interesting objects are those which hold stat
by threatofrain 7y ago
IMO, when people talk about OOP they aren't talking about bags of static functions -- that's just a namespace. The interesting objects are those which hold state.
- sreque 7y agoYou can have an encapsulated object that is immutable and is not a bag of static functions anymore than any object is a bag of static functions. Look at Scala's interfaces for immutable collections. * they are encapsulated. You don't know how the data is stored internally. * There is message passing involved (at the JVM level). The methods are virtual and you don't know exactly which method is being called. There can also be multiple implementations using different data structures. * Late binding is again as defined by the JVM (interface table method lookup) In contrast, a static function is no different than a global variable. When you call it, you know exactly (sans JVM linking) which function you are calling.
- inopinatus 7y agoObjects whose methods are closures are particularly interesting. They hold state, but it can be immutable state.