« September 2006 | Main | February 2007 »
October 16, 2006
Object thought
Carrying on from my previous post I wanted to say something about Object Orientation (OO), and specifically the thing that ‘everybody knows’ about it, namely that it is a style of programming that fits well with people's natural way of thinking. I wanted to see where this notion came from, and I assumed that it came from Smalltalk—an OO programming system developed by Alan Kay and his colleagues at Xerox in the 1970s. I wanted to make the connection between the characterisation of natural thinking, and the image of thought elaborated by AI research: there were strong cultural ties between Kay's group in Palo Alto and AI researchers at Stanford & MIT.
Along with the presumed naturalness of OO thinking, it is often conceded that some people have trouble with programming in this style, but that this is a symptom that they have failed (at some fundamental level) to ‘get’ Object Orientation. At one time this would have been put down to the unhealthy effect of familiarity with FORTRAN or Pascal or some such: a programmer accustomed to the cramping influence of such languages would develop a permanent cognitive stoop. I'm not sure what the story would be now—maybe some people just don't have the right stuff. The current dominance of OO programming languages appears to make it a moot point anyway.
[It will make things more straightforward for me to state my prejudice on this as bluntly as I can. Object Orientation is a curate's egg. The good parts relate to data abstraction and modularity. But the primary and abiding appeal of OO is as a tool of knowledge representation: an ‘ontological analysis’ of a problem domain will reveal it as comprising objects that can be grouped and related by the the is-a and has-a relations of an OO class hierarchy. The pernicious fantasy here is that, with this analysis in hand, the software almost writes itself.]
The trouble with things that ‘everybody knows’ is that there is no need to state them outright. But when an idea is novel there is a greater need for it to be spelt out explicitly. So it makes sense to look at the early history of Smalltalk, even though wasn't the first OO language. (Smalltalk was predated, and influenced, by Simula: an Algol-like language, developed in in Norway in the 1960s, which was used for simulating physical systems. However, Simula was never widely taught outside Scandinavia, and the mainstream, anglophone tradition of OO programming treats Smalltalk as its starting point.)
Consider Daniel Ingalls' 1981 magazine article The Design Principles Behind Smalltalk:
The mind observes a vast universe of experience, both immediate and recorded. One can derive a sense of oneness with the universe simply by letting this experience be, just as it is. However, if one wishes to participate […] in the universe, one must draw distinctions. In so doing one identifies an object in the universe, and simultaneously all the rest becomes not-that-object. Distinction by itself is a start, but the process of distinguishing does not get any easier. Every time you want to talk about "that chair over there", you must repeat the entire processes of distinguishing that chair. This is where the act of reference comes in: we can associate a unique identifier with an object, and, from that time on, only the mention of that identifier is necessary to refer to the original object. […] a computer system provide models that are compatible with those in the mind. […]
A computer language should support the concept of "object" and provide a uniform way of referring to the objects in its universe.
So any action presupposes a mental model representing the world, and such models work in terms of the identification and naming of objects. The compatibility between the mind and a programming language depends on them having these mechanisms in common.
[At this point someone like Rodney Brooks might say that there is no absolute necessity to go from perception to action via a mental model; and that in many circumstances such a model—even a notion of object identity—can be a hindrance: if a picnic is invaded by ants there is no need to keep track of which ant is which is which, nor to find unique names for all of them. And someone like Hubert Dreyfus might say that an emphasis on mental models tends to obscure the phenomenon of skilled activity; and that a mental picture of the world isn't primal but is something that is formed on the basis of a background (but active) ability to cope with the world.]
Later Ingalls says:
The complexity of a system can often be reduced by grouping similar components. Such grouping is achieved […] through classes in Smalltalk. A class describes other objects […] The objects so described are called instances of that class. Even classes themselves fit into this framework; they are just instances of class Class, which describes the appropriate protocol and implementation for object description. […]
Classification is the objectification of nessness. In other words, when a human sees a chair, the experience is taken both literally an "that very thing" and abstractly as "that chair-like thing". Such abstraction results from the marvelous ability of the mind to merge "similar" experience, and this abstraction manifests itself as another object in the mind, the Platonic chair or chairness.
Something that strikes me is that classification is much less fundamental than object identification. The primary justification of the principle is as a way of tackling complexity in programming, rather than as being an essential part of thinking. Furthermore, it seems that classification only makes sense because classes can themselves be taken as objects.
But I've probably spent too long on this article already. Although I've picked out what is said on the importance of objects and of classification, these are just two of the principles described in the article, and Ingalls places no special emphasis on them.
And there's something else. I've already mentioned about classification being treated as a secondary and rather technical matter. But even with object identification, there's quite a difference between saying that programming in terms of objects is ‘compatible’ with people's mental models, and saying that programming this way is natural or that people's mental models are inherently object-oriented. It is almost as if Ingalls was being deliberately cautious on this score, but that this caution must have been lost somewhere along the line.
[Another thing that's bothering me: “a computer language should … provide a uniform way of referring to the objects in its universe.” This says nothing about how, or whether, objects in the computer denote anything outside the computer.]
Alan Kay's paper The Early History of Smalltalk seems even more puzzling. This is a retrospective account of the work done by Kay's research group at Xerox. Being the visionary genius of the group I had expected that he would have quite a lot to say about the philosophy of programming embodied by Smalltalk. But instead he seems more comfortable with anecdotes of run-ins with Xerox management or who it was that wrote the micro-coded bytecode interpreter on which now-forgotten computer system.
The fundamental ontology of Smalltalk—everything is an object—is presented as a side-effect of an exercise in conceptual parsimony. Kay was taken with John McCarthy's meta-circular definition of LISP, which Kay called “Maxwell's Equations of Software”. But he didn't care for the distinction between functions and special forms, and wanted to come up with an even more elegant account. The fact that his solution took the particular form it did could appear almost to be accidental; his acknowledgement of Simula's influence is almost cursory.
Kay's aim was always much more than just devising a new programming language, and I get the impression in his work at Xerox he was gesturing towards something that he couldn't quite articulate. And that maybe he still couldn't, years later.
But none of this is helps with my question. I think I've been looking in the wrong place. Smalltalk's star shines very bright: everyone knows that Alan Kay predicted (by inventing) a future that has now come to pass: personal computers with graphic interfaces connected by global networks. It is possible to be dazzled.
But everyone forgets Simula. Ah, my mistake. Kristen Nygaard's slogan “programming is understanding” makes for a direct connection between the constructs of a programming language and the presumed mechanisms of the mind. Work for another day…
Posted by robin2 at 12:14 AM | Comments (0)