Fat Mac

About two weeks after you could buy them, I bought a 128K Mac and an external floppy drive at a Computerworld store in Monterey. At the time I was working on the Atari ST at Digital Research. I’d somehow latched onto the series of loose-bound chapters that would later become Inside Macintosh, and I really wanted to program the beastie.  I really admired the cleanliness of the internal design (compared to the internals of GEM), and I wanted to get my hands dirty.

But a clean design with awful tools isn’t a wonderful experience.

Programming the Mac proved to be more painful than I was willing to put up with. There was an assembler, but it was slow and every development turn required about 18 mouse clicks. I tried a version of MacForth and quickly remembered how much FORTH disgusted me. My roommate had more perseverance and actually wrote something — a terminal emulator, I think — in some interpreted Pascal environment published by Microsoft.   LightSpeed C and its awesome scale-of-seconds turnaround time wouldn’t exist for a couple of years, and you needed a ten thousand dollar Apple Lisa system to do “serious” development in native Pascal.

I upgraded the 128K Mac to a 512K “Fat Mac” over a weekend in one of the labs at Atari. You needed a pretty beefy soldering iron because the circuit board had massive +5 and ground planes that rapidly sucked heat away from pins you had to desolder. Getting the Mac apart took some ingenuity; Torx drivers were not common then, and the only one I could find was too short to reach the screw heads in their wells in the plastic case. I finally bought a too-short Torx driver anyway, extended it by ramming the barrel of a ball-point pen onto its handle, and used a pair of vice grips to apply torque.

But even having 512K didn’t solve the tools problem.  I wound up selling that first Mac within the year. I admired the Macintosh system software, and to some extent the hardware design (though the ST was even cheaper and leaner and arguably better if you just looked at the chip-level stuff and not the packaging). But actually developing on the thing was the misery of shoveling snow; tons of mouse clicks, no automation, lousy debuggers. I got my money back, and then some, with an ad in the paper.

About two years after that I was working at Apple, on tools.

… and sat down beside ….

Earlier today I was munching on some bulk peanuts from Target (on sale, three bucks. Good protein), and flushing some email.

Quality of the nuts varies, however. (Well, as with the email).

I took another handful of nuts, chewed, and found that one of them had a strange flavor. Kind of sweet and tangy. “Good peanut,” I thought; one of those nonsense, no-consequence thoughts that floats through your head when you’re staring into space and cud-chewing.

A minute later, I ran my fingers through my hair and got back to the keyboard. Something stuck to my fingers. It was the leg of a spider.

Beat.

“Huh. I think I ate a spider.”

Beat.

“Not bad.”

Beat.

“I wonder if there are any more?”

[I was going look, just to see if I could find more evidence and return the rest of them to Target…]

Time out of mind

At a former company, a cow-orker of mine had cobbled up a set of date and time classes that he declared “general purpose” and “bug free.” About three months later, and after he had left the company, I had to do an 11th hour re-write of the code, just prior to releasing our company’s first product.

Some of the bugs I found:

  • The classes had a pretty interface with lots and lots of range, but internally the code used the Unix epoch of 1970 (so no birthdays before then, for instance). It was round-tripping the 1970 epoch through the standard Unix 1970-based routines as well
  • Didn’t handle 400-year cycle of leap years
  • Fell apart in 2038, like everything else will (Unix epoch, natch)
  • Fell apart in 2008, 2010, 2012, and some other years, as I recall. One failure was like some random day in March 2007, I forget why
  • Obviously didn’t handle screw cases like the calendar skipping that happened in 1582
  • Forget about supporting astronomy or geology applications…

… and other things.

I recall writing unit tests that stepped through the ranges that we definitely cared about (several tens of thousands of years around the current epoch), and also stepped plus-and-minus in the billions of years ranges (by millions or thousands, I think). Random tests, too.

I also recall spending a lot of time reconciling OLE’s idea of date-and-time. (Don’t ever let me catch you using floats for something like this. Really. I’ll find you).

This stuff is not easy to get right, but everyone thinks that it is. Maybe that’s why people get it wrong so often (“Oh, it’s just same date/time code, I’ll just whip this out and go to lunch.  Umm, ’30 days hath November, except September, May, and, uh…'”)

Required reading: Calendrical Calculations. Unless you write stuff used by archeologists can probably ignore the Mayan (etc.) calendars, but they’re fun to read about.