Skip to content


Why or Why Not Objective-C?

My friend Pete recently started developing apps for the iPhone using Objective-C and loves it:

I can’t believe we all used C++ when Objective-C was sitting there. I don’t care that message passing is slower1. It’s f*cking genius.

Objective-C has been around for about as long as C++, why isn’t it more popular? The simple answer is that early on when object-oriented programming was becoming popular, C++ got into the hands of more developers than Objective-C.

The first C++ compiler called Cfront generated C code. The end result was code that just about any C compiler could compile. Shortly after, inexpensive native C++ compilers such as Zortech appeared. This was followed by vendor support from companies like Microsoft, Borland, Sun, etc.

In contrast, Objective-C was originally a product from a single company PPI (aka Stepstone). NeXT licensed the technology for NeXTstep in the late 80s but never developed into a large enough market for most developers. When NeXT was purchased by Apple, the same language and runtime were used for Mac OS X and eventually the iPhone. Certainly if this hadn’t happened Objective-C would be little more than a historical footnote, not a mainstream language.

There’s another issue when discussing Objective-C: portability. It was used by NeXTstep, now Mac OS X and nonexistent elsewhere. What happens when you want your code to run on other platforms?

When we developed Improv for NeXT we wrote the UI in Objective-C, everything else in C++. The usage of C++ was partly historical since a lot of the code started out on OS/2. But we retained this separation: source files continued to be either pure Objective-C or pure C++. There was a thin facade layer between the two. We also developed an application called Presentation Builder which produces graphs and diagrams for Improv. It was entirely written in Objective-C. When we ported Improv to Windows (and Mac for a while), we were able to retain the back-end code and rewrite the UI in C++. But we couldn’t reuse any of the Presentation Builder code since there was no Objective-C compiler for Windows at the time. We had to rewrite it from scratch. In fact, we couldn’t even salvage the Presentation Builder file format since relied on the AppKit serialization format which, as far as I know, NeXT never documented. Since Presentation Builder relied heavily on Display Postscript, we still would have had quite a bit of work to port it but we would have been able to salvage some of the code.

Apple’s current recommendations for Mac OS X developers is to write UI in Objective-C (Cocoa) and use anything you like for the rest. So what does Apple use for their own cross-platform apps? I’ve read that iTunes is more-or-less pure C++ but much of Safari is written in Objective-C, even on Windows. So Apple must have Objective-C tools (and frameworks) for Windows.

My personal take on Objective-C is that while it’s not as “pretty” as C++ it’s also much easier to learn. Objective-C is clearly an add-on to C rather than an attempt to define a new language. Objective-C syntax is derived from Smalltalk and message passing is explicit in the language. In C++ method calls use the same syntax as accessing struct members in C. But language syntax is secondary. The real beauty of developing in Objective-C isn’t just the language — it’s the AppKit/Cocoa frameworks. And a big part of that is the late-bound dynamic nature of the language, something that’s still hard to do in C++.

  1. Message passing in Objective-C isn’t always slower than C++ virtual method calls.

Posted in Programming.


Twenty Years!

Twenty years ago today was my first day at Lotus. Normally I wouldn’t recall a milestone like this but I thoroughly enjoyed working for Lotus back in those days. It was an upbeat and successful company and I worked on fantastic product with a terrific team. So pardon me for indulging in a bit of nostalgia…

A few months prior, a headhunter called me at home. I was expected another call so picked up rather than letting it go to voice mail (no Caller ID back then). He mentioned several people I had worked with before wouldn’t tell me who had passed along my name. He pitched a job at Lotus working on a PC database project. I wasn’t happy with my current job but I didn’t really want to write PC software. A week later he called about another job at Lotus. This other team was working on a secret project that was supposed to be really cool and was a closer match to my interests. So I scheduled an interview. The interviews went well and I got excited about the project while talking to the team. When I found out that they were writing software for NeXT, I really wanted the job. The code name was “BackBay” which became Lotus Improv.

When I accepted the job offer I asked the headhunter again for the name of the person who passed along my name, it turned out to be a co-worker. Her husband worked for Lotus. Small world.

Prior to Lotus, I developed software for Unix workstations; primarily CAD software. On my first day during new employee orientation I felt like a fish out of water. All of the other new employees were conversant in Lotus products: 123, Manuscript, Agenda… I’d never used a spreadsheet before and knew next to nothing about PC software. What was I doing there? But it turned out okay; at least in the short term. The Improv team was run like a startup, separate from the rest of Lotus and developed solely on NeXT.

After orientation, I settled into my new office. On my desk was a brand new NeXT cube. After setting it up I quickly discovered its beauty wasn’t skin deep. Before Lotus, I had SGI and Sun workstations on my desk. But despite their high-end graphical capabilities, GUI-based apps were nearly non-existent. Most of my day was spent in shell windows using emacs, gdb, etc. We wrote design specs using text-based formatters such as troff or scribe. When I needed something better, I’d write specs on my Mac. Conversely, developing software on Unix was a joy but developing for the Mac back then was painful. No multi-tasking, no virtual memory, etc. In contrast, NeXT had the best of both worlds for users and developers — rich graphical apps like a Mac on a Unix-based OS. For example, the NeXT Mail application was beautiful and powerful. It let you send richly formatted text with pictures and file attachments. It may not sound like much today but in the days before HTML and MIME, just having email access, much less email with rich content, was uncommon.

Working on a “secret” project with NeXT was a lot of fun. NeXT had started out in the education market but was trying to move into the enterprise. Steve Jobs had come out to Lotus and got a demo of an early Improv prototype running on OS/2. He convinced Lotus management to build the first release on NeXT. The team had been working on the NeXT release for less than a year when I started. Jobs would come out to Cambridge occasionally to check on our progress.

All of our hard work culminated in the first public demonstration of Improv as part of a NeXT product announcement at Davies Symphony Hall in San Francisco. Ashton-Tate and Informix also announced spreadsheet products for NeXT at the same event but, with a typically Jobsian twist, NeXT announced that Improv would be bundled with all new NeXT computers. The Ashton-Tate and Informix folks were livid. Lotus Improv 1.0 for NeXT shipped the following February.

One other thing from those early days: During my first week at Lotus I ran into someone I worked with at Applicon. He told me that he worked on Lotus Notes then paused, expecting some sort of reaction. I had to explain that I didn’t know what Notes was. A couple years later when we moved off NeXT to Windows development, I had my first experience with Notes. Compared to NeXT, it was God-awful. Ugly. Primitive. Slow. It was really hard to appreciate the underlying power under that ugly facade. Fortunately for Lotus, it did get better later.

Posted in Uncategorized.


Nobody Hates Software More Than Software Developers

Jeff Atwood: One of the (many) unfortunate side effects of choosing a career in software development is that, over time, you learn to hate software. I mean really hate it. With a passion. Take the angriest user you’ve ever met, multiply that by a thousand, and you still haven’t come close to how we programmers feel about software. Nobody hates software more than software developers. Even now, writing about the stuff is making me physically angry.

Sad but true.

Posted in Programming.


the setup

the setup is a bunch of nerdy interviews with developers such as Joe Hewitt, developer of the Facebook iPhone app. They discuss what hardware and software they use as well as their “dream setup”. I didn’t expect that Jakob Neilsen and I would have something in common — we both carry around an old Palm phone and an iPod touch.

Posted in Uncategorized.


Comments

Haloscan comments are going away and will be replaced by Echo. I guess I should post more to have something to comment about.

Posted in Uncategorized.


The Ultimate Machine

A few days ago I posted a link to The Most Useless Machine. Useless but pretty cool. Apparently Claude Shannon used to have a similar device on his desk he called the “Ultimate Machine” based on an idea by Marvin Minsky. There are more details and a few videos of other versions of the box at www.leavemealonebox.com

The design reminds me of a coin bank I had as a kid. You put a coin on top and a skeleton hand pops out, drags the coin away and closes back up. I’ve found several videos of similar banks on Youtube.

Posted in Uncategorized.


C++ in Coders at Work

Peter Seibel, author of
“>Coders at Work
, asked most of the book’s interviewees how they felt about C++. Not surprising that most opinions were negative.

I haven’t written a substantial amount of C++ code since I worked at Iris. And I have no plans to ever go back. That said, I used to enjoy C++, despite the complexity. But once we started to to use templates and STL it got really unpleasant, especially since our code had to compile on several different platforms. Dealing with C++ compiler differences between say, Solaris and HP-UX, is painful. And compared to languages like Java and C# which offer garbage collection, array-bounds checking, type safety, extensive class libraries, etc. C++ is generally more pain that it’s worth.

Posted in Programming.


IntelliJ IDEA Open Sourced

IntelliJ IDEA has just gone open source:

Starting with the upcoming version 9.0, IntelliJ IDEA will be offered in two editions: Community Edition and Ultimate Edition. The Community Edition focuses on Java SE technologies, Groovy and Scala development. It’s free of charge and open-sourced under the Apache 2.0 license. The Ultimate edition with full Java EE technology stack remains our standard commercial offering. See the feature comparison matrix for the differences.

I guess it was just a matter of time before IntelliJ either disappeared or went open source. Competing against free IDEs (Eclipse and NetBeans) in the development tools market has to be pretty tough.

Posted in Programming.


BlogPress post

Testing BlogPress from iPod touch.

Here is Swine flu Patient Zero:

Posted in Uncategorized.


History of Visual Studio

If you developed Windows applications in C/C++ during the 90s, you probably used Visual Studio at some point. Rico Mariani has written his own “History of Visual Studio” in four blog posts.

When we ported Lotus Improv to Windows 3.1 we used Borland C++. Debugging was done using a Hercules Graphics Card with a separate monitor. When you stopped at a breakpoint, everything froze. It was horrible. In contrast, as Rico mentions, Visual C++ 1.5 supported “soft mode debugging” which allowed other apps to keep running. A neat trick in a “cooperative multitasking” operating system. I’d always wondered how they did that.

Note: by the time VC++ 1.5 came out, we had already moved Improv from 16-bit to 32-bit Windows, getting it ready for what eventually became Windows 95. Unfortunately, the next release, Improv 3.0, was canceled in 1994.

Posted in Programming.