4 ms·
I seen various descriptions of message passing in OOP that wind up meaning "invoke a method, alter an object, return an answer." Lots of different ways to descr
by ben509 6y ago
I seen various descriptions of message passing in OOP that wind up meaning "invoke a method, alter an object, return an answer." Lots of different ways to describe a method, lots of ways to modify the object, lots of ways to return an answer, but conceptually, they're all just invoking a method.
I think in some languages and frameworks, message passing is associated with expressing a GUI, so objects have handlers for events, and there is more structure around how events can be signalled and handled. I'm thinking of Smalltalk, Hypercard and modern browsers.
It's also more distinct in concurrent programming with something like communicating sequential processes (CSP), where message passing is a way for concurrent processes to agree on how to share state. So when process A writes some data to a channel C it explicitly hands that data off, thus process B can read from C and operate on the data without corrupting anything. (Contrast with threads where you can modify anything, any time, so you have to use locks and deal with deadlock and such.)