Brad Cox’s “Object-Oriented Programming” (1986)
A few weeks ago I had a chance to re-read this particular book by Brad Cox1. It is also the first book that introduced the Objective-C language to the world.
It’s not a heavy book — at 274 pages including index, Cox has outlined his solution for the software reusability problem in a succinct language (yes, pun intended). The book spends the first two chapters on why reusability is essential to mitigate the complexity in building a large system, what Cox calls “software crisis”, and on how the object-oriented programming paradigm, which Cox describes using the analogy of integrated circuits (“Software ICs”), is in turn the way to achieve reusability.
In the following chapters, Cox describes the language that he designed to fulfill his vision of Software IC: Objective-C. A short introduction and evaluation of Smalltalk-80 is given, and comparisons with Ada and then C++ are also provided. Cox likes many aspects of Smalltalk-80: The language is designed for personal computing, with interaction and graphics in mind (remember this is the language that gives the birth to modern graphical user interface), and it has many advanced features in its time: virtual machines with persistent stores (so say “saving files” is an unnecessary feature), a language built on blocks (think lambda) and message passing mechanisms, an IDE, and so on. As for why Smalltalk-80 didn’t become mainstream, Cox’s explanation is that Smalltalk-80 is a language designed for research purposes. To be of practical value, a hybrid language that can work with existing infrastructure will have a better chance:
My own interest in hybrid object-oriented language developed from the dream that organizational computing and personal computing could meet each other halfway, via a bridge over which arbitrary data could flow with minimum programming intervention. The bridge is created by providing the organizational computer with its own object-oriented programming language so that data can be put into object form. Object passivation [persistence] machinery […] can automatically convert this data into a form that Smalltalk can read and vice versa, so that much of the information transfer could be done automatically. This, and C’s ability to access databases maintained on older languages like FORTRAN [Cox also mentions COBOL in previous paragraph], creates a bridge between data locked in the mainframe and the user by relying on the ability of Smalltalk-80 to build user interfaces rapidly.
For the rest of the book, Cox describes the features of Objective-C in detail with an example of using the language to build a visual graph manipulation tool. Some syntactical features are no longer found in today’s Objective-C (e.g. the
= ClassName declaration, and the feature that class declaration and definition are one unified compilation unit, much like Java, instead of separate parts). In the first of the last two chapters, Cox outlines the architecture of an “iconic user interface” — the model-view-controller paradigm (MVC), which was also introduced by Smalltalk. The last chapter briefly discusses the runtime environment (such as garbage collection) and possibilities for other higher-level language features, including “virtual object memories”2, concurrency (using coroutines), distributed systems and coordination systems3.
Overall, I find the book full of insights that still resonate, 25 years after its publication. It’s interesting to take a historical perspective on how much progress we have made since then. Objective-C had never been as popular as C++, a “competitor” in some senses, or as Java, some features of which are actually influenced by Objective-C (such as interfaces, or what Objective-C calls protocols). NeXTSTEP, the first platform that heavily used Objective-C as the main language, was never mainstream. It takes Mac OS X, and then iOS, to propel it to one of the most popular programming languages worldwide. And many ideas are still waiting for more refined realizations. Some, like garbage collection, finally become an option on desktop platform. Some, like concurrency, are still things that frustrate programmers, expert or novice alike. Perhaps, like what some who teach functional programming would like to show, we are past the apex of the object-oriented model, and a new paradigm shift awaits.
Cox, Brad J. Object-Oriented Programming: An Evolutionary Approach. Addison-Wesley, 1986. I’m referring to the first edition here. If you know the differences between its first and second editions, I’d appreciate it if you can write something about it. ↩
We can identify some of Cox’s description of such a “capability-based” addressing system in today’s uniform resource identifiers (URI). ↩
Although gcc has been supporting gc-capable Objective-C for years, it was not possible to use it in Mac applications due to lack of framework support. Apple eventually came up with its own “mix of curry” of concurrent, generational garbage collector, with runtime and full framework support, in 2006. Objective-C also has a feature called Distributed Objects, which is often used among Mac applications for inter-process communications. Library support for operation-based concurrency became part of the Mac OS X 10.5 framework, again since 2006. ↩