folklore.org, October 1984

by Andy Hertzfeld

 

Having taken a leave of absence from Apple in March 1984, I started collaborating with a tiny company named Thunderware. We created a product named Thunderscan, a low-cost, high-resolution scanner for the Macintosh. I started work in June, and it was nearly complete by early October.

 

Tom Petrie was one of principals at Thunderware, and a previous collaborator when we were at Apple working on the Silentype thermal printer. He arranged demonstrations with various computer magazines, and on October 11th, 1984, I drove with Tom to Hillsborough to demonstrate Thunderscan to Byte Magazine.

 

The reviewer was John Markoff, a well-known journalist covering the personal computer industry for the San Francisco Chronicle. Tom described Thunderscan while I prepared the demonstration and started scanning. John asked a few questions. He took notes with his IBM PC running a character-based text editor that I viewed with the typical pious disdain of a Macintosh purist. While I was answering a question, the phone rang.

 

“Excuse me,” he told us, as he pressed a key combination on his keyboard. His screen instantly changed to a different program. He talked on the phone for a minute or two, occasionally typing before he hung up and pressed a key combination to switch back to his Thunderscan notes.

 

“What did you just do?,” I asked John, curious about the software that he was running. “How did you switch to another application so quickly?”

 

“Oh, I‘m running Memory Shift. Haven‘t you seen it?” John responded. “It‘s a DOS utility program that keeps multiple applications resident in memory, and allows you to switch between them quickly. I‘ve been using it a lot lately.” John typed the switch command a few times in rapid succession, to show me how fast it could do its thing.

 

“You know, I think I could do that for the Macintosh”, I suddenly blurted out, before I even thought about it consciously.

 

The 512K Macintosh had just begun shipping. With four times the memory at your disposal, I had considered trying to run multiple applications simultaneously, but was stymied by low memory conflicts and other potential gotchas. But now, as I observed Memory Shift in action on John‘s PC, I suddenly saw a simple way to do it.

 

“Yeah, that would be cool,” John agreed. I continued, somewhat distracted, with the Thunderscan demo, unable to stop thinking about application switching. There were a few intricate problems to solve, but it seemed eminently doable.

 

Tom Petrie noticed my excitement, and reminded me of my prior commitments as he drove me home. He made me promise to finish the alpha release of Thunderscan as soon as possible before daring to start something new. We agreed on a list of about a dozen tasks—about two weeks worth of work. Afterwards, I could take a break and work on application switching, then dive back into the final release of Thunderscan for the end of November.

 

During the next two weeks, I focused on polishing Thunderscan, but I also spent idle moments pondering the design of the application switcher. One fundamental decision was whether to load all the applications into a single heap or to allocate separate “heap zones” for each application. The first approach would make optimal use of memory by minimizing fragmentation. I wasn‘t sure my final decision was right, but I opted for separate heap zones to better isolate each application.

 

There were lots of little problems to solve. The most crucial one was that of low memory, where the system software kept global variables for each application. These needed to be swapped in and out so each application could maintain its own set.

 

The difficult part was coming up with a precise list of exactly what needed to be swapped. Many of the variables were obvious, but some were quite subtle, and dependent on how applications used them. I knew that my first attempt wouldn‘t be perfect, but I was confident I could debug the inevitable problems once I saw how the applications failed in practice.

 

Just after the final push on Thunderscan, the phone rang. It was Jeff Harbers, the manager of Microsoft‘s Macintosh applications team. He said they had a very strategic project that they needed for the Macintosh, and thought I was the ideal person to implement it. Jeff wouldn‘t say anything else over the phone, but offered to fly me up to Seattle to have a discussion in person. Though I was right in the middle of finishing Thunderscan, I was intrigued enough to accept.

 

The following Tuesday, Jeff picked me up at the airport and we drove to Microsoft‘s main building. We were joined by Neil Konzen, a talented 23 year-old who was Microsoft‘s main systems programmer on the Macintosh. I knew Neil from his days as an early Apple II hobbyist, when we collaborated on adding features to an assembly language development system when he was only 16.

 

Jeff seemed interested when I told him about Thunderscan, but when I mentioned the application switcher, his jaw dropped in disbelief.

 

“That‘s just what we wanted to talk with you about!”, he exclaimed. “It‘s great that you‘re already working on it.”

 

Microsoft wanted me to write an application switcher under contract.

 

They had worked hard to ensure their applications ran well in the tiny memory of the original Macintosh. While this was a key competitive advantage, the 512K Mac would undermine their efforts as competing applications could now b e larger and more sophisticated.

 

Meanwhile, Lotus had announced an integrated application suite for the Macintosh called Jazz. Written for the 512K Mac, it was very quick to switch between each of its functions. But if the Macintosh could run multiple applications simultaneously, the small memory footprint of the Microsoft applications could still have an advantage: you could potentially free up memory by only launching the applications you needed, unlike the monolithic Lotus product.

 

Neil sketched out a potential design for an application switcher on a whiteboard. He chose the single heap approach that I had rejected, along with some interesting twists to minimize memory fragmentation.

 

I outlined the reasoning behind my strong preference for separate heap zones, trading memory fragmentation for greater robustness, and said I would give his approach some more thought.

 

My afternoon at Microsoft culminated in a private meeting with CEO Bill Gates. Jeff ushered me into Bill‘s office. He reviewed the afternoon‘s discussions before excusing himself, leaving Bill and I alone to negotiate a deal.

 

I had met Bill a few times during the course of Macintosh development, and while I respected his understanding of technology, I was wary of his burgeoning reputation as a conniving businessman.

 

We exchanged a few pleasantries and Bill told me how much the Macintosh mattered to Microsoft. Then he looked me in the eye and said, “You‘re a really good programmer, right? I think you must be a really good programmer.”

 

“I guess so,” I responded, not understanding why he was attempting to flatter me.

 

“Well, I think you are. How long do you think it will take to do this project? A month or two? I think a really good programmer like you could get it done in less than two months.”

 

“I really have no idea,” I replied, “I‘m not far enough along to know if it‘s even feasible yet.”

 

“Well, let‘s figure it out,” he said in a slightly condescending tone. “I don‘t think it could be more than 10,000 lines of code, and a really good programmer like you should be able to write at least a thousand lines of code per week, so I think it will take you less than 10 weeks to write it, if you‘re as good as I think you are.”

 

I didn‘t know how to respond, so I kept quiet and let him continue.

 

“And how much do you think a really good programmer should get paid? Around here we pay our best programmers around two thousand dollars per week. Do you think you should be paid more than that?”

 

“I don‘t know,” I replied. I finally began to see it: Bill was trying to get me to brag that I could write the application switcher quickly so he could justify paying less for it.

 

“Well, I don‘t think that you could expect to get more than four thousand dollars per week, tops. Actually, I think that‘s too much, but let‘s go with that. If it takes ten weeks, and you get paid four thousand dollars per week, that means you should get paid $40,000 for writing it.”

 

$40,000 didn’t sound like very much to me, especially if the project was so strategic to Microsoft. I think Bill expected a counteroffer. But regardless of compensation, I wasn’t enthusiastic about selling it to Microsoft, and felt it should eventually be part of the Mac OS.

 

“Listen, I really want to write this, completely independently from you guys, so you won’t have to pay me anything to do it. I certainly don’t want to negotiate a deal until I see how it turns out; there might be a show-stopper and I won’t be able to get it to work at all. And if I pull it off, it really should be bundled with every 512K Macintosh.”

 

Bill shifted his tactics. “OK, I don’t really care if Microsoft owns it as long as it’s available to our users. I want you to commit that you’ll apply your best efforts to making sure that it runs well with our applications, and that you’ll call Jeff if you run into any snags. We can talk again about publishing it later if you want to after you’re further along. How does that sound?”

 

I told him that sounded good, and promised to do my best. I wanted it to work well with Microsoft’s applications anyway they were important to most users. We shook hands and I departed on a positive note.

 

By the time I returned to my home in Palo Alto that evening, I was burning with the desire to build a proof-of-concept of the application switcher. Even though still I had more work to complete for Thunderscan, I set to work.

 

The quick proof-of-concept had no user interface, and was hardwired to run MacPaint, MacWrite, MacDraw and the Finder. I worked 20 hours straight. The core of the program worked by patching traps to extend a few essential system calls, like GetNextEvent, Launch and ExitToShell. The hardest part was going through all of the low memory locations, determining what needed to be swapped. It was incredibly satisfying to see it begin to work, initially crashing all the time, but gradually stabilizing as I tracked down various problems.

 

I’d had it working for about an hour when I saw Bud Tribble return home. Bud had finally finished his M.D./Ph.D. program at the University of Washington, including a year-long internship. He decided that working on the Macintosh was more fun than being a doctor, and returned his role as software manager at Apple in July of 1984. Bud was living next door at Burrell Smith’s house.

 

I dragged Bud over to my house and showed him how rapidly I could switch between MacPaint, MacWrite and MacDraw. He was impressed, but to my surprise he complained that the switching, which was almost instantaneous, was actually too fast.

 

“I think it might be confusing to switch from one application to another without any feedback,” he told me. “What if someone switches accidentally? Maybe you could use animation to make a smoother transition.”

 

That sounded like a great idea. We decided that one application should scroll off the screen horizontally while another was scrolling on. This gave users a simple, concrete mental model of the applications wrapped around a sort of Lazy Susan. They could rotate to move the desired application to the visible area. I quickly wrote some fast scrolling routines, and was blown away by how cool it looked to see the applications zip across the screen.

 

I started showing the proof of concept to my friends at Apple, as well as a few user groups. It was very positively received. Unfortunately, I still had to finish up the product release of Thunderscan, which I barely managed to do by the end of November as I had promised.

 

After a short vacation, I got back to work on what I now called “Switcher” in early December. By Christmas I had much of it implemented, including a simple user interface for selecting applications, and “Switcher Documents” for remembering sets of applications.

 

In January 1985, I got a phone call from Guy Kawasaki, one of Apple’s developer evangelists. He said Apple was interested in buying Switcher, and that he had been assigned to make that happen. The first step was arranging a demo for Steve Jobs.

 

I entered Steve’s office with a bit of trepidation. I felt Switcher was worth at least a quarter of a million dollars to Apple, though I was sure that Steve would never want to pay me that much. But I was also proud of Switcher, and was interested in seeing how Steve would react to it.

 

I booted up my now standard set of applications, plus the Finder and a little maze generating program written by Steve Capps. I began the demo with the scrolling animation turned off, so it would have more impact when I showed it later. I demoed cutting and pasting between MacWrite, MacPaint and MacDraw in seconds instead of minutes. Then I turned on the scrolling animation, and starting switching rapidly between them, in both directions.

 

“OK, I’ve seen enough,” Steve interrupted me. “It’s great. Apple is going to bundle it with the Mac. Congratulations.”

 

But then he paused, and stared at me for a moment with an incredibly intense gaze, as if he was sizing me up or maybe just trying to scare me.

 

“But I don’t want you taking advantage of this situation. I’m not going to allow you to take advantage of Apple.”

 

“What do you mean?” I asked him, genuinely puzzled.

 

“There’s no way that you could have written that program without confidential information that you learned by working at Apple. You don’t have the right to charge whatever you like for it.”

 

I started to get angry. “The program is only half finished, and if I don’t think you’re paying me fairly, I won’t be motivated to finish it.”

 

Steve gave me another intense stare as he paused for a few seconds. Then he stated a single number, without explanation.

 

“One hundred thousand dollars.”

 

“I don’t know,” I told him, “I think it’s probably worth a lot more than that.”

 

“Don’t argue with me. $100,000 is fair, and you know it.”

 

I didn’t seem to have any alternative but to capitulate. Steve is difficult to argue with and I really wanted Switcher bundled with the Mac. Final negotiations took place with Guy Kawasaki where, in addition to the $100,000, I managed to get a 10% royalty of the wholesale price if Apple sold Switcher as a separate product. Steve swore they would never do this, but eventually the royalty delivered another $50,000.

 

Starting work on Switcher hadn’t been too hard, but finishing it was extremely difficult. It overturned some of the underlying assumptions that applications made, yet it was committed to ensure all applications worked.

 

Most of the latter stages involved testing Switcher with every application I could get my hands on and debugging crashes. Usually I could concoct some kind of technique that would mitigate the problem without causing worse problems elsewhere.

 

Predictably, the hardest part of finishing Switcher was making it work smoothly with Microsoft applications. This was partially because Microsoft was a very early developer, and took liberties with the system that most developers would shy away from. However, it was mostly because the instructions comprising their applications were encoded in pseudo-code to save space. This followed the tradition of the byte-code interpreters from Xerox, which Charles Simonyi advocated.

 

Unfortunately, the pseudo-code kept me from disassembling the program when it crashed, making debugging very difficult. I finally hit upon the trick of single stepping through their interpreter six instructions at a time to get the instructions doing the actual work. It was pretty painful, but I was determined because of the promise I had made to Microsoft.

 

The last problem I addressed was that of hangs. When running multiple applications, you don’t want one application hanging to take down all of them. I added a feature that allowed the user to kill the current application if it had hung by monitoring for a specific key combination in the vertical blanking interrupt handler.

 

I had to pick a very rare key combination to prevent users from killing their applications accidentally. I decided on four keys held down at once: shift-command-option-period. But I was surprised when I got a call from Jeff Harbers at Microsoft.

 

“Hey, I like that abort feature that you just added, but you’re going to have to change the key combination. We’re using that in Microsoft Word.” Microsoft Word was very complex, and it possessed an enormous range of keyboard shortcuts—way too many, as far as I was concerned.

 

“OK, suggest something for me to change it to and I’ll consider it,” I told Jeff.

 

Jeff said he would get back to me soon. I had to laugh when he called me back the next day and withdrew his request, and told me to keep the original key combination.

 

“OK, that sounds good to me,” I told him. “But why the change? Doesn’t it still conflict with Word?”

 

“We’ll change Word in the next release not to use it. The problem was that we couldn’t find a safe sequence. I guess we’re already using every key combination!”

 

I officially released the finished version of Switcher in April 1985. I maintained it for a few versions after that. Eventually, I handed it off to Phil Goldman, a tremendous young programmer from Princeton recently hired at Apple. Phil went on to write MultiFinder, Switcher’s eventual successor, with Erich Ringewald in 1987.

 

 

  1. • •

 

(extra material as seen on folklore.org)

 

Letter to Mr. Andy Hertzfield [sic]

January 1985

 

Dear Andy,

 

I just got a chance to play with your “switcher”. It is really great! I have been demoing it to everyone who walks in my office. Unfortunately the disk I got it on also had “AMAZING”, so I have wasted a lot of time solving mazes.

 

I am very excited about the “switcher”. It will give everyone creative ways to use their 512K Macs. It is very important for us to make sure the switcher work well with all of our applications. We are going to add sections to the manuals for all of our applications to describe how to use them with the switcher.

 

I am impressed at how quickly you are getting this project done. You are really the only person who knows all the system’s insides well enough to get it done. Keep up the good work!

 

Best regards,

Bill Gates

 

cc: Jeff Harbers