6 ms·
Kay on the Meaning of "Object-Oriented Programming"
- raganwald 15y agoI like the notation "<-" instead of "." Here's why: "<-" looks like sending a message. "." looks like a scoping construct. Thus, to my brain, "." implies synchronicity: Invoke this function and continue with the result, it's just that the language implementation will do some fiddly stuff to look up the function's implementation in an inheritance hierarchy at run time. Whereas "<-" implies asynchronicity: Send this message to this independent entity that has its own memory, processor, whatever. If you need a reply, send a continuation along with it, a'la current Javascript style.
- arethuza 15y agoI've felt for a long time that the tendency to equate "sending a message" and "calling a function/method" has caused a lot of problems - one is more like IPC/RPC and the other is something that happens within the local context (process/thread/etc.).
- pacala 15y agosending a message = piping sending a message with callback = continuation passing style
- arethuza 15y agoI think the Transputer/Occam and Google Go have a better approach where they were influenced by Hoare's CSP: http://en.wikipedia.org/wiki/Communicating_sequential_processes http://en.wikipedia.org/wiki/Communicating_sequential_proces...
- abecedarius 15y agoYou've almost just described E (http://erights.org http://erights.org). The recipient of a message sent with "." must be in the same E process (called "vat"), while with "<-" the recipient may be remote (but needn't be) and the value we immediately continue with is a promise for the eventual result. (Each vat receives one message at a time and runs it to completion before taking the next off the queue, Actors-style.) This was the language that taught me what Kay was talking about.
- seles 15y agoWhat is wrong with data?
- gnaritas 15y agoIt's bad, in the sense that it leads you to write tightly coupled code that depends on it. The whole point of objects are to hide data and instead expose behavior so other code is coupled to the objects behavior rather than its internal implementation on a specific set of chosen data. This leaves you free to fiddle with the internal implementation without breaking the external API, which leads to modular loosely coupled code.
- cousin_it 15y agoNothing! The extreme opposite to Smalltalk in this respect is the APL/J/K family of languages where everything is expressed as mathematical operations on multidimensional arrays of data. For example, a K programmer wouldn't use an array of rectangles, preferring to have separate arrays of widths and heights. It's a very eye-opening programming style in its own right, and a curious programmer would do well to get acquainted with both. Here's a nice page of "K finger exercises": http://kx.com/technical/contribs/eugene/kidioms.html http://kx.com/technical/contribs/eugene/kidioms.html . To someone who grew up on modern OO languages, it's unbelievable how much K manages to accomplish in one line of code.
- cconroy 15y agoWhat does Kay mean by late-binding? ... not the dynamic binding of overriding methods in a subclass or virtual functions (C++)? The last paragraphs compared smalltalk with lisp in this respect.
- nvarsj 15y agoI think he does mean runtime binding, as with a virtual function call. But probably more extreme - instead of a lookup table to find the static type, a message is simply sent to the receiving object. The object itself then handles it based on its type definition (which itself could be defined at runtime).
- gnaritas 15y agoAnd the object can handle messages for which no function exists at all.
- sedachv 15y agoThis (#doesNotUnderstand:) is not very widely known but extremely important: http://carcaddar.blogspot.com/2009/04/closure-oriented-metaprogramming-via.html?showComment=1239507240000#c7399536579144180363 http://carcaddar.blogspot.com/2009/04/closure-oriented-metap... http://people.csail.mit.edu/gregs/ll1-discuss-archive-html/msg02096.html http://people.csail.mit.edu/gregs/ll1-discuss-archive-html/m...
- igrekel 15y agoNot being in his head, I'll try to guess from what I know of smalltalk. It means the actual binding of a message to the method to execute is done only when the message is received. TOo give you an idea, you may associate some code to specific messages to an object at runtime, you may also implement doesNotUnderstand and decide how to handle messages who don't have corresponding methods (forward it to another object, have some special behavior, create the method on the fly as needed).
- 15y ago
- lepton 15y agoWe should really link to http://www.purl.org/stefan_ram/pub/doc_kay_oop_en http://www.purl.org/stefan_ram/pub/doc_kay_oop_en which is still valid and may outlast fu-berlin.de.
- hercynium 15y agoNope, that's down for me, too. However, I managed to snag something on Coral: http://userpage.fu-berlin.de.nyud.net/~ram/pub/pub_jf47ht81Ht/doc_kay_oop_en http://userpage.fu-berlin.de.nyud.net/~ram/pub/pub_jf47ht81H...
- InnocentB 15y agoI get a 403 from that link too...I've actually never seen that from Coral before, anyone know what's going on?
- russell 15y agoKay mentions the Burroughs B5000. Boy you have to be an old timer to have worked on that. I did some Algol programming on the B6500, the next generation. They were stack machines, but what was interesting was that the memory words were typed in the B6500 and on. IIRC, the add instruction was not typed as it is in nearly all other machines, but it did a integer add or double add based on the tag bits of the operands. Wikipedia has a good article, http://en.wikipedia.org/wiki/Burroughs_large_systems http://en.wikipedia.org/wiki/Burroughs_large_systems
- arethuza 15y agoI think the Burroughs CANDE shell was by far the worst user environment I have every used on any system - the only nice thing (at least for Tron fans) being at least things were being fed to the MCP: http://en.wikipedia.org/wiki/Burroughs_MCP http://en.wikipedia.org/wiki/Burroughs_MCP
- russell 15y agoIn those days everything was terrible. We had to deal with 360 JCL an similar abominations. You couldnt dignify them with the term shell. It was timesharing and ultimately Unix that liberated us.
- rickmode 15y agoSounds like Erlang is close to Dr Kay's notion of OOP - though my Erlang-fu is not strong enough to know if it has polymorphism.
- thesz 15y agoYep. I should note that OO means "objects having state". You can send identical messages to different processes and they can respond with (structurally) same answers, so Erlang is polymorphic enough to be OO. "Erlang might be the only object oriented language because the 3 tenets of object oriented programming are that it's based on message passing, that you have isolation between objects and have polymorphism": http://www.infoq.com/interviews/johnson-armstrong-oop http://www.infoq.com/interviews/johnson-armstrong-oop
- rudiger 15y agoErlang also has support for extremely late binding method dispatch. It's a bit tongue-in-cheek to call it a lightweight object-oriented programming language, though. I wouldn't use processes as objects in practice. My successful Erlang programs usually use fewer and more long-lived processes than I use objects in C++, Java, and Objective-C.
- thesz 15y ago>My successful Erlang programs usually use fewer and more long-lived processes than I use objects in C++, Java, and Objective-C. I think I could attribute it to lack of tools in C++, Java and Objective-C. You basically forced to use objects for almost everything (especially in Java). In Erlang, however, you have tuples, higher-order functions and pattern matching, among with process creation and message send/receive. They are different from processes (and objects) and that's where your feeling come from.
- silentbicycle 15y agoYes. Rather than having a table of methods in a class or prototype, each process has an event loop with a set of messages it can pattern match on. The rough equivalent of a process changing from one class to another would be tail-calling into a different recieve { (set of pattern-matching expressions) } function. Instead of changing classes, it looks more like a state machine.
- elcron 15y agoaeohu