I recently had the opportunity to interview Erica Sadun, author of The iPhone Developer's Cookbook: Building Applications with the iPhone SDK (second edition in progress at the time of this interview). Erica has been very active in iPhone development. I wanted to ask her opinions on the platform, and its relationship both to desktop OS X and the more general computing landscape.
David Chisnall: There are lots of rumours about what will be announced at the keynote this year. Is there anything you're particularly hoping for?
Erica Sadun: I have been hoping for a new, larger tablet running iPhone OS that might compete in the netbook/Kindle arena. The iPhone works very well as a sub-netbook, but greater screen space would really help bring the unit into the boardroom, the classroom, and, for medical personnel, the exam room.
DC: You mentioned competing with the Kindle. Where do you see eInk-based devices going, in terms of convergence with things like the iPhone or iPod Touch?
ES: eInk brings something special to the table that is separate from what, say, an iPod touch offers. As the latest display technologies continue to evolve and mature, I can see there being two branches of hand-held development for a while. Do I want to see Apple going into eInk? It's certainly an avenue that offers great possibility, but at the same time beyond text readers, is there a compelling need for that low-power, high-contrast kind of display? So I'm torn. It's cool stuff, but I still would rather have a touch-based iPhone OS tablet rather than a Kindle when all is said and done.
DC: On the software side, is there anything you're hoping will be added to the Cocoa Touch SDK at the WWDC?
ES: I would love background processing and, especially, command line access. I am not holding my breath. At all.
DC: When and why did you originally learn Objective-C? What other languages were you most familiar with at the time?
ES: I was fortunate enough to learn Objective-C from Pixar's Randy Nelson (a flying karamazov programmer) in 1989 at a NeXT seminar, during beta 0.8 of the NeXT Step OS. (I think it was '89. Might have been '88.) At the time I had spent some time professionally programming in Lisp, but my background was more specifically in C, which was the lingua franca of the day.
DC: Having spent a lot of time working on the iPhone, what do you think the most difficult thing is for people coming from a desktop-Cocoa development environment?
ES: On the desktop you have a full multitasking environment and huge screens. On the iPhone, the rule goes: Small Screen, Big Fingers, Little patience. Everything else follows from that. You must design in a way that is respectful of the small space available to you (not to mention your user's eyesight!) And you must understand that you only get access to your user for short spurts of time. When calls come in or the user steps off the commuter bus, you need to clean up after yourself in a way that will let that user pick up where he or she left off.
DC: On a related topic, do you think it's easier for people unfamiliar with Objective-C to learn to program the iPhone or OS X on the desktop?
ES: A strong programming background helps when moving to any new platform, regardless of the language. If you have already mastered procedural and object-oriented systems, then jumping into Xcode, Cocoa Touch, and Objective-C will be far less painful.
At the same time, the iPhone is a great platform to learn programming on. You can build very simple programs that take few lines of code and deliver high impact applications. So if you've got a basic application skeleton to work with, like the kind that Xcode provides through its pre-built templates, you can learn hands-on.
DC: I was recently asked why I thought Apple didn't put Flash on the iPhone. What are your views on this? Do you think having Flash would harm native application development?
ES: Apple has always maintained that Flash would consume too many resources, but if rumors about upcoming iPhone models hold true (faster processors, more RAM), I could see Flash on the iPhone OS, particularly for any tablet devices if Apple gets around to selling them.
As for harm? I really doubt that. I don't think that any avenue of development harms another.
ES: With the latest HTML standards with off-line data storage, we've really entered the age of standalone web applications. It's just one more way of delivering product to consumers.
As for the second part of your question, the iPhone is part of that blurring, that change. It's no longer important where you are and what platform you compute on. It's all about your data and where it lives. So long as you can sync to a central data store, applications get re-defined. It's already happened with activesync and Entourage.
I can sort through my mail on my laptop and my desktop reflects those changes. The iPhone is riding that wave, along with the Mac and every other platform out there. The difference is that the iPhone can fit into someone's pocket and connect inexpensively to WWAN services. You may lose some user interface options to that size, but with centralized data computing, you don't miss out on access.
DC: AppKit was originally designed to run on machines with a 25MHz CPU, 8MB of RAM, and no GPU. The iPhone is a lot more powerful than this and yet Apple chose to introduce a new API. Why do you think they did this? What are your views on the removal of NSCell, an optimization designed for memory-constrained systems?
ES: From an API point of view, Cocoa Touch is simply beautiful. Rather than stay wedded to the old way of doing things, Apple built this entire SDK from the ground up, bringing over the best classes and providing replacements as newer, better version became available. It's astonishing how much Apple delivered in terms of a public SDK given the amazingly short period of time they had to do so.
It's easy to complain about certain design choices Apple made (and trust me, I do so both professionally and loudly), but it's also easy to overlook what a spectacular result they've delivered with the 2.0 and 3.0 SDKs.
Their classes and their APIs have been designed with mobile computing in mind, and I'm well satisfied with most of the results. Many classes that I missed in 2.x showed up in 3.0, and I'm sure that many more will arrive in 4.0.
DC: As you said, Apple had the luxury of not having to think about backwards compatibility when they designed the Cocoa Touch APIs. This isn't the case on the desktop, or for other platforms, which have accumulated a lot of legacy-compatibility requirements over the years. If you had to pick one abstraction or concept that made sense in the '80s when these other systems were designed, but that the iPhone managed to disregard, what would it be?
ES: I'm going to answer this sideways. Because the one thing that jumps out at me, that really defines the 80's, was the advent of desktop multitasking, the ability to run more than one program at a time, as controlled by the end-user.
With the iPhone, Apple completely stomped on that, and I don't mean that in a bad way, as you'll see. Here's a full-powered Unix-based OS, and it's been transformed into a device where you can run only one thing at a time and you can't switch back and forth between tasks. (Unless those tasks have been provided by Apple, like music control and phone calls.)
And it's not really just Apple doing this. If you look at the latest Linux-based Netbooks, they've taken the same "it's a device not a computer" philosophy, hiding away the underlying OS with all its power and providing the simplest possible, most approachable UI, as with the HP Mini mi.
From an end-user perspective, this has been a huge win for Apple, as for HP and other manufacturers. We don't care what OS is running on our TiVos; the gadgets just work. They're simple, they're elegant, they're fun.
From a developer's point of view, it's admittedly limiting and frustrating. But at the same time, the more that a device like an iPhone succeeds in the market place, the more work there is for developers. So for every fussy technical door that closes, Apple is certainly opening a lot of well-designed very-inviting other doors.
DC: Do you think being Objective-C-only is a barrier to entry for iPhone development? Are there any other languages you'd like to see supported?
ES: This is a hard question to answer because I so passionately love Objective-C, which weds Smalltalk and ANSI C. These are two languages I spent many years using. Apple supports Objective-C++, which is an Objective-C extension of C++ (or a C++ extension of Objective-C). This support has brought in a lot of developers who otherwise might be turned off by Objective C.
The truth about Objective-C is, though, that it's insanely easy to learn. You can master it completely in a couple of hours if you start with a C-language background.
But programming on the iPhone isn't just about Objective-C. It's about Cocoa Touch, the libraries and frameworks that provide all the classes you use on a day-to-day basis. And mastering Cocoa Touch is a much broader problem. That's why I love writing pre-built code snippets that demonstrate how to solve problems using Cocoa Touch classes and calls. That kind of mastery, which will obviously be more available to Mac Cocoa programmers than, say, some guy who just walked in off the street, is one that must be built over time.
DC: There have been a few high-profile cases of iPhone apps being rejected from the App Store. Do you think having Apple as the gatekeeper for all iPhone software is a problem for iPhone development, or do the advantages in terms of vetting and stability outweigh this?
ES: I can argue both ways. As for the current system, it desperately needs a ticketing system so developers are not left in the dark about where their app lies in the review process. More transparency and a better system for protesting decisions would eliminate nearly all developer complaints.
DC: At the moment, the iPhone has a much smaller market share than Symbian or even Windows Mobile. Why would you encourage developers to work with such a niche platform?
ES: I don't think you need to actively encourage developers. I think the iPhone itself sells the platform. Anyone who is excited and passionate about the iPhone who would like to develop for it can join in. The SDK is a free download, and if you decide you want to make a commitment to iPhone development, the $99 per year fee is a low business cost for gaining access to App Store.
DC: The iPhone SDK is now at version 3; how much do you feel it's evolved since its creation? What are the most important changes?
ES: The first version of the iPhone SDK was somewhat rushed out to meet announced deadlines. They could have done with another year or so to really develop what was essentially a new OS X platform, complete with development environment. In the year and a bit, the SDK has greatly matured as has the iPhone OS itself. The most important changes are stability and completeness. Classes that were MIA at the beginning have now appeared or show signs of being added soon. Apple can now step back and start designing mobile-specific libraries rather than focusing on getting the OS and basic SDK finished.
DC: What projects are you currently working on?
ES: I'm hard at work writing the 3.0 update to my iPhone Developer's Cookbook. Like last year, it's being held back by the ongoing (and frustrating) NDA. After the Cookbook update, I'll be collaborating on iPhone Unleashed, which will focus more on best practices and App Store.