Software Development

Alan Kay Was Wrong About Him Being Wrong

Time to time someone is asking me what I think about what Alan Kay, the father of OOP, the designer of Smalltalk, the first object-oriented language, said in 1998 about OOP. He literally said that the very term “object” was misleading and a more appropriate one would be “messaging.” Here is what I think.
 
 
 
 
 
 
 
 

Rain Man (1988) by Barry Levinson

I believe that there are two orthogonal means of interaction between objects: messaging and composition. Let’s say, we have a point and a canvas:

Point p = new Point(x, y);
Canvas canvas = new Canvas();

This is how messaging would look:

p.printTo(canvas);

The problem with messaging is that it keeps objects on the same level of abstraction. They communicate as equal and independent “modules,” sending data messages to each other. Even though they look object-oriented, the entire communication pattern is very procedural. We try to encapsulate as much as we can inside a single object, however inevitably still having to expose a lot of its data in order to be able to “connect” it with other objects.

We turn objects into “little computers,” as some books refer to them. They expect data to come it, process the data, and return back some new data. The maintainability problem is not really solved with this approach—we still have to deal with a lot of data, remembering its semantic outside of the objects. In other words, there is no true encapsulation.

On the other hand, this is how composition would look instead:

Point p2 = new PrintedOn(p, canvas);

Every time we need objects to communicate we create a bigger object that encapsulates more primitive ones, letting them interact inside. Of course, the data will also go from object to object, but that will happen inside a bigger object. We can even make the encapsulator and the encapsulatee “friends”, as I suggested before, to make that interaction more transparent and avoid data exposure through getters or even printers.

Let me quote Alan Kay again:

The key in making great and growable systems is much more to design how its modules communicate rather than what their internal properties and behaviors should be.

It seems to me that he means modules, which are not objects. These are different things. Modules are elements of the architecture, while objects are elements of the design. These are two different levels. At the level of architecture we obviously need messages and Kay’s statement is perfectly correct. However, at the level of design we need composable structures, to increase maintainability and messaging is not what can help us achive this goal.

Thus, I believe Alan Kay was right when he invented objects, called them objects, and gave their programming style “object-oriented” title.

Published on Java Code Geeks with permission by Yegor Bugayenko, partner at our JCG program. See the original article here: Alan Kay Was Wrong About Him Being Wrong

Opinions expressed by Java Code Geeks contributors are their own.

Yegor Bugayenko

Yegor Bugayenko is an Oracle certified Java architect, CEO of Zerocracy, author of Elegant Objects book series about object-oriented programing, lead architect and founder of Cactoos, Takes, Rultor and Jcabi, and a big fan of test automation.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments
Back to top button