Avoiding Copland

In what's rapidly becoming my favorite program on 5by5, John Siracusa last Friday discussed a topic he raised over five years ago about Apple's long range technical debt — the kind of thing that nearly killed Apple in the 90s. Or as he put it in his series of Ars Technica articles in 2005: Avoiding Copland 2010.

Let's see how short I can make my version of history. Legend has it that Apple's engineers had a big brainstorming session where they discussed all the stuff that Mac OS ought to do but didn't. The "easy" stuff was written on blue cards and became the feature set of System 7, while the "hard" stuff was written on "pink" cards and became Copland, Taligent, and OpenDoc. Of these three, Copland was by far the least visionary: it was essentially going to be a backward-compatible version of Mac OS with memory protection and pre-emptive multitasking. Taligent was going to be an object-oriented operating system. And OpenDoc was going to be a document-centric architecture.

If any of these projects had succeeded, they might have either "saved" Apple or at least propped it up for a few years. If nothing else, Apple might have been in a better bargaining position in its negotiations with Be, or whatever. (Of course this would have probably worked out badly in the long run.)

But in fact all three crashed and burned.

Copland failed because it tried to be all things to all people and simply didn't work. In essence, it refused to put pre-Copland apps in a "compatibility box" and wait for them to die, and instead tried to finagle a way for them to be first class citizens. The result was a disaster.

Taligent was done in partnership with IBM and quickly turned into a bloated mess.

OpenDoc was crippled by a fundamentally flawed model of what a document-centric architecture ought to do. In essence, the designers of OpenDoc thought that a blank page with opaque rectangular components was a perfectly flexible model for the generic document. It turned out that every actual use case quickly broke the model (Photoshop documents are layered and translucent, design elements in Quark XPress frequently overlap, and don't even start on 3d modeling tools).

Even Apple's one signal success from the period (the PowerPC alliance with Motorola and IBM) ended up being a drag in the long run as Motorola and IBM each lost interest in desktop CPUs. It's not clear that Apple would have been better off going with Intel back in the 90s (with the benefit of hindsight, Sculley thinks so now), but certainly at the time, and for years afterwards, the decision was generally well-received (the main question was why Apple didn't simply go with Motorola's 88x00 series RISC chips).

I think it's important to understand that Apple's failures in the mid-90s were monumental, fueled by hubris, and inter-related. Just consider that Apple (a) thought that not having memory protection and pre-emptive multitasking were a huge deal, (b) it dedicated its best engineers to solving the problem (which is why many of its "great ideas" were pushed out-of-house to joint ventures like Taligent, OpenDoc, and Kaleida), and then (c) it conspicuously failed to execute.

Right now, if Apple has some kind of big, obvious technical debt issue, it's not clear what it is. If you accept that it exists it's not clear that Apple agrees with you. And even if Apple agrees with you there's no evidence that they're squandering huge resources on executing a solution.

Increasing Abstraction

Siracusa's main thrust is that Apple's big weakness is in developer tools. Abstraction increases over time, allowing us to avoid solving the same problems over and over again. While everyone developing applications for Windows is able to write managed code running on virtual machines and use nice APIs and smart IDEs, Apple developers are stuck with Objective-C, manual memory management, and Xcode.

He further argues that Apple appears to be as far away, today, from having a good tool story as it was five years ago, but that the unexpected success of iOS has simply given it some more breathing room. Even so, Apple's terrible tools are eventually going to repel developers who can get stuff done quicker and better on other platforms.

Two Meanings of Abstraction

In his use of the word "abstraction" Siracusa means two different things and sometimes incorrectly conflates them. The difference between "machine code" and "assembler" is a case in point. The only difference between programming in assembler and machine code is convenience. You're using the same instructions in the same way, but assembler lets you read and write human-readable symbols instead of binary or hex code to get the job done. The assembly-level programmer enjoys a huge increase in productivity over the machine code programmer with no change in the efficiency of the final code. In fact, efficiency will almost certainly increase since the programmer will be able to devote more time to algorithms and logic and less time to parsing patterns of bits.

It's important to differentiate conceptual abstraction (i.e. the ability to use higher level concepts and constructs to describe and solve problems) from implementation (e.g. when code written in one language runs on a virtual machine written in another language, perhaps ad nauseum). And the reason it's important to differentiate them is that conceptual abstraction is pretty much a pure benefit (as per the assembler vs. machine code example above) while implementation abstraction can be a benefit, but there's a price to pay.

Furthermore, there are, in a sense, two fundamental kinds of progress we tend to see in programming languages. In one case a new abstraction is created that makes programmers' lives easier — some examples that come to mind are OOP, garbage collection, functional programming, closures, iterators, and exceptions. Because "more abstract" (dynamic, interpreted) languages are more flexible and easy to experiment with we tend to see these features arise in them first. It follows that juicy new goodness tends to come at a price in performance.

But the second case is also important, which is that many abstractions are then adopted by "less abstract" (or "lower level") compiled languages. Some abstractions are difficult to adapt and thus take longer. But, by and large, they tend to get there in the end.

To put it simply, I believe Apple is very focused on maximizing conceptual abstraction while keeping a very firm handle on implementation abstraction. So is Google. Microsoft, not so much.

Managed Code

One of the biggest red herrings in this discussion is the idea of managed code. The basic idea is this: a program consists of instructions. A bad instruction can cause the computer to crash, resulting in lost data (or some other inconvenience). Crashing is bad. But if we run our code in a sandbox of some kind then it can be prevented from ever crashing the computer, avoiding the inconvenience. Yay!

This kind of thinking has led to many, many levels of "sandboxing" on modern computers. You're probably reading this on a web browser. The code in this page is "sandboxed" within this page (or to pages from this website) within the browser. In theory the code can't "escape" from the page and, say, read your bank login details on another page. Similarly if your browser tries to write to some arbitrary location in memory it should be blocked by the memory protection scheme. And your browser is supposed to talk to the hardware via calls to the kernel which supposedly filter out requests that might crash the system. And on and on.

But here's the thing: if I write bad code in a web app and you use the web app and it crashes, you lose data. Your data. It doesn't matter that the code couldn't crash your browser, because the browser doesn't own your data. And it doesn't matter that the browser can't crash the OS. And on and on.

In practice there are limits to the benefits of sandboxing, and managed code has thus far failed to deliver its promised benefits of stability and security (two of the biggest sources of security issues on Windows and Mac OS X are Java and Flash which are both virtual machines running managed code). In the end, your computer needs to run machine code — there's no way around it. Piling additional layers on top of it has not proven enormously helpful.

Objective-C

Probably John's most flawed criticism of Apple's technical toolchain were his comments about memory management. This is because, as of Leopard, Objective-C has pretty much automated memory management. It's hardly perfect, but it's significantly improved from retain/release. Now, memory management is still manual on the iPhone, but that's because (in Apple's opinion) the benefit (ease of programming) is outweighed by the cost (performance, battery life). Because Microsoft and even Google rely on more abstract implementations (virtual machines with garbage collection) they simple cannot in the end match Apple's performance.

Again, because Siracusa conflates abstract concepts with abstract implementations he fails to realize that — memory management aside — Objective-C (and Cocoa) is at least as abstract from a programmer point of view as C# (and Cocoa), and in some cases more so.

 

— Tonio Loewald,