Long-time Mac developer Craig Hockenberry wrote a fascinating article back in February, “So you’re going to write an iPhone app…” offering some lessons learned from writing Mobile Twitterific. Here’s the highlights.
On reusing code from Cocoa projects for Mac OS X:
Don’t expect to reuse much of your existing code. If you’re using a standard MVC design (which is pretty much inescapable if you’re using Cocoa) then about 2/3rds of the application will require major rework.
From my experience, your models and the infrastructure that support them can be reused without much effort. On the other hand, the multi-touch interface obviates the need for your existing views and controllers.
This won’t be a problem for me, because I don’t have any existing code, at least not any existing Cocoa code.
On memory:
There are some very tight limits on memory usage. You’re given approximately 64 MB of space to work with (about half of what’s available.) If you go beyond that, Springboard shuts you down unceremoniously. That combined with the fact that there isn’t any swap space where unused objects can go to rest, makes for some design decisions that you haven’t had to consider in the desktop environment.
I think I can live within 64 MB as long as I keep that limitation in mind as I design and write my app.
On UI complexity:
The good news is that the user interface is much less complex. The bad news is that the user interface is much less complex.
If you have a rich desktop application with hundreds of features, you’ll find that it’s hard to pick what you absolutely need. Culling features isn’t easy, but it’s absolutely necessary.
Here again, I don’t have to worry. I won’t have to cull features, because I don’t yet have any. Maybe this is an advantage to starting from scratch for the mobile platform.
On look and feel:
Don’t think that your desktop and mobile application will share any look and feel. There may be slight resemblances with regard to branding, but that’s about it. Does Safari look like MobileSafari?
I might be able to work this problem in reverse: develop the mobile version first, then later make the desktop version. In theory, at least, it should be easier to make a desktop app look like a mobile app (and build from there) than vice versa.
On the simulator:
It’s likely that there will be a simulator in the iPhone SDK. Don’t believe for a second that you’ll be able to use this simulated device for all your development and testing. You have to literally live with the application.
I don’t pretend that I can get by without running on the real hardware. Running on the target is a must for any embedded application. On the other hand, until I get into the commercial iPhone developer program, I’m going to have to get by with the simulator. I hope I get accepted soon, but if I don’t, I’ll just have to live with it. I imagine that I can write most or all of the code using the simulator, but when it comes to testing and wringing out the bugs, I’m going to need real hardware.