Chapter 11. Howdy, Neighbor

PLAYING NICE WITH OTHER APPS

"GOOD FENCES MAKE GOOD NEIGHBORS," poet Robert Frost tells us. According to Apple, good fences make good apps, too. The sentiment is baked deep into the iPhone OS, which purposely makes it all but impossible for apps to peek into each other's affairs. Every app is safely walled off in its own plot, where other apps can't touch its data, can't meddle with account information, can't talk back and forth in an intimate way. Every app is more or less isolated.

There are benefits to the iPhone's mind-your-own-business culture: the overall system is more stable, a bad-seed app can't rifle through private info, and the arrangement promotes the useful habit for both developer and consumer to focus on just one task at a time. But fences also make us travel a long way to go what would otherwise be a short distance. Exchanging documents between apps is often a round-about hassle of syncing to a PC or network, and reusing the data you create in one app means a slow slog of copying and pasting into another. Walls block useful collaboration among apps, and that's hardly neighborly. Even Robert Frost agrees. In the very same "good fences make good neighbors" poem, he writes:

Photo: Peter Morgan

Figure 11-1. Photo: Peter Morgan


Before I built a wall I'd ask to know
What I was walling in or walling out,
And to whom I was like to give offence.
Something there is that doesn't love a wall,
That wants it down.

Mr. App Designer, tear down this wall. Many of these fences are too sturdy to overcome completely, but tapworthy apps make an effort to be sociable nevertheless. This chapter explores ways to throw information over the walls between apps as well as strategies for making transitions between apps less labored (and sometimes even unnecessary). Before you start vaulting fences, though, first take a look at the places where the fences have already been pulled down.

While the iPhone locks up most information in a private vault for each app, a handful of built-in apps share their info, creating a few public spaces in a neighborhood that's otherwise blocked by walls and fences. Any app has permission to read, add, or edit this shared info: contacts, photos, and (starting in iPhone OS 4.0) calendar events. Apps can also access the user's systemwide preferences, the things you select in the Settings app. Apps that embrace these public archives save headaches for both developers and users.

For your audience, there's calm confidence in knowing that there's a single master collection of contacts (or photos or events). It creates a trustworthy system: no matter what app you might use to edit contact info, there's comfort knowing that it winds up in "The Master List." People strongly associate those collections with their respective built-in apps—Contacts, Photos, and Calendar—but context makes it immediately obvious when other apps are working with this same familiar content. Apps may provide different windows into this information, but it's reassuring when those windows always look out onto the same view.

By contrast, when information is tucked away into separate pockets, we're burdened with remembering exactly where to find it and how one pocket differs from the rest. Don't keep your own separate stash of contacts, photos, or events. If your app deals even tangentially with people, images, or time, consider how the app might interact with these shared collections instead of keeping the information to itself. A happy side effect is that this approach saves development time, too. Subscribe and contribute to these common data stores, and you don't have to build your own. Some suggestions for putting this shared content to good use:

It would be handy if you could arrange data mixers like this for other kinds of info, too, inviting any and all apps to build mash-ups with your own app's data, for example. Alas, the iPhone is not that kind of party. You can get crazy with contacts, photos, and events, but your exchanges with other apps have to be more limited. Even so, there are opportunities to get at least a little bit cozier with certain apps by sending work their way and letting them know that you'll accept the same.