Chapter 1. What Makes a Killer iPhone App

In This Chapter

  • Figuring out what makes an insanely great iPhone application

  • Discovering the features of the iPhone that can inspire you

  • Facing the limitations you have to live with

  • Understanding Apple's expectations for iPhone applications

  • Making a plan for developing iPhone software

Faced with the complexity and the utter hopelessness of the situation, John Belushi in Animal House bellowed "Road trip!" In that movie, their plans were a no-brainer — just grab the beer and go — but for most people, preparation would be a bit more complicated. You'd need to gather all the maps, the hotel and campground brochures, the flyers and postcards that describe the places you want to visit, the most recent weather report for the areas you are traveling through, the schedule of appointments you need to keep, and your car's service records and vehicle ID, and throw all this stuff in the front seat . . .

Or just take your iPhone and the RoadTrip application (also known as the app) that this All-in-One book shows you how to create. To give you insight to the iPhone application-development process, this book describes how to develop and publish two apps: the simple and straightforward DeepThoughts, which is a meditative app that co-author Neal wrote in a frenzy one afternoon (too much caffeine that day?), and the more industrial-strength RoadTrip, which Neal developed in response to his daughter's 7,000 mile road trip.

The advantages you have with an iPhone app are more than just the difference between fumbling with papers and maps versus using an electronic device that stores everything. With an iPhone, an app can present information that is relevant at that moment — relevant to where you are, what time it is, and what your next activity might be. Because the iPhone platform offers a strong foundation for these functions, the app already knows your current location, the hotels or campgrounds you are going to stay at, and the sites you are planning to visit. Rather than pulling off the road and searching maps and brochures, you can know at a glance where you are, how to get to your destination, and what the weather's like so that you know what to wear (as shown in Figure 1-1).

The RoadTrip app (see Book V) can present info that's relevant to where you are at any moment of your trip.

Figure 1-1. The RoadTrip app (see Book V) can present info that's relevant to where you are at any moment of your trip.

The iTunes App Store is loaded with travel apps, so you know already that finding apps like this one is not a fantasy. You may think it a fantasy that you could develop such an app in less than two months, starting from where you are now, with no iPhone programming experience. But you can — the only question is whether you can make a great app, or even a killer app. To do that, you need to look at what it takes for an iPhone app to be truly great.

Figuring Out What Makes a Great iPhone Application

In the App Store, you can find over 140,000 apps that take you far beyond the Stocks, Maps, Weather, Contacts, Calendar, YouTube, and other apps preinstalled by Apple on the iPhone. Popular social networks such as Facebook and MySpace offer apps to connect you with your friends on those services. Google offers an array of services through the Google Mobile app, including the ability to edit documents and spreadsheets, use the Gmail service, and share calendars and photos. Twitterific lets you post tweets on Twitter, and WhosHere and SKOUT can connect you directly to other iPhone users for chatting. Newspapers, book readers, shopping helpers, streaming music players, fitness calculators . . . the list goes on and on.

Most apps are designed to take advantage of the iPhone's multitouch display; accelerometer (which detects acceleration, rotation, motion gestures, and tilt); or GPS for detecting its physical location — or all three. Motion X Poker is actually a dice game that uses the accelerometer to let you roll the dice by shaking the iPhone. The Flick Fishing app senses motion so you can cast a fishing line with a flick of the wrist. Location is very important: Showtimes uses your iPhone's location to show the closest movie theaters; Eventful uses it to display local events and venues; and Lethal can tell you the dangers that might surround you, such as the hostile animals, the likelihood of crimes, the prevalence of disease, and the potential accidents and disasters.

These apps fall along a continuum, which at one end might be called the mobile desktop, and at the other end a mobile here-and-now experience. The mobile desktop apps are ones you might use if you wanted to do the kinds of things you normally do with your computer but didn't have it handy — applications you could port to (rewrite for) the iPhone. For example, you might already have Weather, Stocks, Twitter apps, and book reader apps on your MacBook Pro, and it doesn't take any major imaginative leap to see how one can do these things on an iPhone. Although I can't write this book on an iPhone, it's still handy for note taking, searching, blogging, social networking, and stock-trading.

At the other end of this continuum are apps that serve a need that a desktop (or even a laptop) can't handle well, either because you don't want to carry the hardware around with you or because, even if you did, using it that way would be way too inconvenient. Imagine being at Heathrow Airport, dead tired, taking out your laptop in the middle of a crowded terminal, powering it up, launching the application, and then navigating through it with the touchpad to get the information you need — which you can now get while holding the iPhone in one hand. You want that kind of information quickly and conveniently; you don't want to have to dig your way to it through menus or layers of screens (or even going through the hassle of finding a wireless Internet connection). Seconds count. By the time any road warrior tied to a laptop did this at Heathrow, you should already be on the Heathrow Express.

With here-and-now apps, you want to do a specific task with up-to-date information, which the iPhone can access over the Internet through a cell network or Wi-Fi connection. You may even want the information or tasks tailored to where you are, which the iPhone can determine with its location hardware.

Somewhere in the middle of this continuum, most likely closer to the mobile desktop side, are apps that best-selling author Seth Godin would call meatball sundaes — "the unfortunate result of mixing two good ideas," according to his book Meatball Sundae: Is Your Marketing out of Sync? (Portfolio Hardcover). If the meatballs are the things I need, the commodities that so many businesses are built on, then the sundae toppings are the new marketing techniques, social networks, blogs, and fancy stuff that make people excited. But slapping them together doesn't make a good sandwich or a dessert. It doesn't work to take an old product, apply it to a new medium, and expect success.

With all that in mind, there are at least two things that you need to consider — besides functionality, of course — when it comes to creating a great iPhone app:

  • Exploiting the platform

  • Creating a compelling user experience

The rest of this chapter and Chapter 2 of this minibook dig more into this Two-Part Rule of Great iPhone Applications.

Exploiting the Platform

The iPhone's unique combination of software and hardware gives you the power to create an app that lets users do something that may not be practical (or even possible) with a laptop computer. Although the iPhone is a smaller, mobile personal computer, it isn't a replacement for one. It isn't intended to produce formatted documents or well-crafted spreadsheets (although some apps work with documents and spreadsheets). The iPhone has the capability to be an extension of the user, seamlessly integrated into his or her everyday life. With it, you can accomplish a singly focused task or step in a series of tasks, in real time, based on where you are.

Device-guided design

Although the enormous capabilities of the iPhone make it possible to deliver a necessarily compelling user experience, you must take into account the limitations of the device as well. Keeping the two in balance is device-guided design. The next two sections describe both the features and limitations of the iPhone — and how to take them into account as you plan and develop an app. But understanding these constraints can also inspire you to create some really innovative apps. After a closer look at device-guided design, I come back to what makes a compelling user experience.

Exploiting the features

One of the keys to creating a great app is taking advantage of what the device offers. In the case of a new platform with new possibilities, such as the iPhone, this is especially important. Think about the possibilities that open up to you when your app can easily do the following:

  • Access the Internet.

  • Know the location of the user.

  • Track orientation and motion.

  • Track the action of the user's fingers on the screen.

  • Play audio and video.

  • Access the user's contacts.

  • Access the user's pictures and camera.

Accessing the Internet

The ability to access Web sites and servers on the Internet gives you the ability to create apps that can provide real-time information. An app can tell a user, for example, that the next tour at the Tate Modern in London is at 3 p.m. This kind of access also allows you, as the developer, to go beyond the limited memory and processing power of the device and access large amounts of data stored on servers, or even offload the processing. You don't need all the information for every city in the world stored on your iPhone, and you don't need to strain the poor CPU to compute the best way to get someplace on the Tube. You can send the request to a server and have it do all that work.

Note

This is client-server computing — a well-established software architecture where the client provides a way to make requests to a server on a network that's just waiting for the opportunity to do something. A Web browser is an example of a client accessing information from other Web sites that act as servers.

Knowing the location of the user

The iPhone operating system (OS) and hardware lets you create an app that can determine the device's current location or even be notified when that location changes. As people move, it may make sense for your app to tailor itself to where the user is, moment by moment.

Many iPhone apps use location information to tell you where the nearest coffee house is or even where your friends are. The RoadTrip application uses this information to tell you where you are and give you directions to your hotel.

When you know the user's location, you can even put it on a map, along with other places he or she may be interested in. In Chapter 3 of Book V, I show you how easy that really is.

Tracking orientation and motion

The iPhone contains three accelerometers — devices that detect changes in movement. Each device measures change along one of the primary axes in three-dimensional space. An app can, for example, know when the user has turned the device from vertical to horizontal, and it can change the view from portrait to landscape if doing so makes for a better user experience.

You can also determine other types of motion such as a sudden start or stop in movement (think of a car accident or fall) or the user shaking the device back and forth. (What's Shakin' uses this feature to give you a percussion instrument.) It makes some way-cool features easy to implement — for example, the Etch-A-Sketch metaphor of shaking a device to reset it, and controlling a game by moving the iPhone like a controller.

Tracking the action of the user's fingers on the screen

People use their fingers, rather than a mouse, to select and manipulate objects on the iPhone screen. The moves that do the work, called gestures, give the user a heightened sense of control and intimacy with the device. Several standard gestures — taps, pinch-close and pinch-open, flicks, and drags — are used in the applications supplied with the iPhone.

Tip

I suggest strongly that you use only the standard gestures in your app. Even so, the iPhone's multitouch hardware and software allow you to go beyond standard gestures when appropriate. Because you can monitor the movement of each finger to detect gestures, you can create your own, but use that capability sparingly — only when it's undoubtedly the right thing to do in your application.

Playing audio and video

The iPhone OS makes it easy to play and include audio and video in your app. You can play sound effects or take advantage of the multichannel audio and mixing capabilities available to you. You can also play back many standard movie file formats, configure the aspect ratio, and specify whether controls are displayed. This means your app not only can use the iPhone as a media player, but can also use and control prerendered content. Let the games begin!

Accessing the user's contacts

Your app can access the user's contacts on the iPhone and display that information in a different way or use it as information in your application. As a user of the RoadTrip application, for example, you can enter the name and address of your hotel, and the application files it in your Contacts database. That way, you have ready access to the hotel address, not only from RoadTrip, but also from Phone and other applications. Then, when you finally arrive in San Francisco, the application can retrieve the address from Contacts and display directions for you.

Accessing the user's pictures and camera

As with Contacts, your app can also access the pictures stored on the user's phone, not only to display them, but also to use or even modify them. For example, the Photos app supplied with your iPhone lets you add a photo to a contact, and several applications enable you to edit your photos on the iPhone itself. You can also incorporate the standard system interface to actually use the camera as well.

Embracing the iPhone's Limitations

Along with all those features, however, the iPhone has some limitations. The key to successful app development — and to not making yourself too crazy — is to understand those limitations, live and program within them, and even learn to love them. (It can be done. Honest.) These constraints help you understand the kinds of applications that are right for this device.

Note

Often, it's likely that if you can't do something (easily, anyway) because of the iPhone's limitations, then maybe you shouldn't.

So learn to live with and embrace some facts of iPhone life:

  • The small screen

  • Users with fat fingers

  • Limited computer power, memory, and battery life

The next sections can help get you closer to this state of enlightenment.

Living with the small screen

Although the iPhone's screen size and resolution allow you to deliver some amazing apps, it's still pretty small. Yet while the small screen limits what you can display on a single page, all you need to perform is some mental jujitsu to really think of it as a feature.

When your user interface is simple and direct, the user can understand it more easily. With fewer items in a small display, users can find what they want more quickly. A small screen forces you to ruthlessly eliminate clutter and keep your text concise and to the point (the way you like your books, right?).

Designing for fingers

Although the multitouch interface is an iPhone feature, it brings with it limitations as well. First of all, fingers aren't as precise as a mouse pointer, which makes some operations difficult (text selection, for example). User-interface elements need to be large enough (Apple recommends that anything a user has to select or manipulate with a finger be a minimum of 44 × 44 pixels in size) and spaced far enough apart so that users' fingers can find their way around the interface comfortably.

You also can do only so much using fingers. You definitely have a lot fewer options using fingers than you do using the combination of multibutton mouse and keyboard.

Because it's so much easier to make a mistake using just fingers, you also need to ensure that you implement a robust — yet unobtrusive — Undo mechanism. You don't want to have your users confirm every action (it makes using the app tedious), but on the other hand, you don't want your app to let anybody mistakenly delete a page without asking, "Are you sure this is what you really want to do?" Lost work is worse than tedious.

Another issue around fingers is that the keyboard isn't that finger-friendly. Using the keyboard is not up there on the list of things I really like about iPhones. So instead of requiring the user to type some information, Apple suggests that you have a user select an item from a list. But on the other hand, the items in the list must be large enough to be easily selectable, which gets back to the first problem.

But again, like the small screen, this limitation can inspire (okay, may force) you to create a better app. To create a complete list of choices, for example, the developer is forced to completely understand the context of what the user is trying to accomplish. Having that depth of understanding then makes it possible to focus the app on what's essential, eliminating anything that's unnecessary or distracting. It also serves to focus the user on the task at hand.

Balancing limited computer power, memory, and battery life

As an app designer for the iPhone, you have several balancing acts to keep in mind:

  • Although significant by the original Macintosh's standards, the computer power and amount of memory on the iPhone are limited.

  • Although access to the Internet can mitigate the power and memory limitations by storing data and (sometimes) offloading processing to a server, those Internet operations eat up the battery faster.

  • Although the power-management system in the iPhone OS conserves power by shutting down any hardware features that are not currently being used, a developer must manage the trade-off between all those busy features and shorter battery life. Any app that takes advantage of Internet access using Wi-Fi or the 3G network, core location, and a couple of accelerometers is going to eat up the batteries.

Note

The iPhone OS is particularly unforgiving when it comes to memory usage. If you run out of memory, it will simply shut down your app. This just goes to show that not all limitations can be exploited as "features."

Why Develop iPhone Applications?

Because you can. Because it's fun. And because the time has come (today!). Developing iPhone apps can be the most fun you've had in years, with very little investment of time and money (compared with developing for platforms like Windows). Here's why:

  • iPhone apps are usually bite-sized, which means they're small enough to get your head around. A single developer — or one with a partner and maybe some graphics support — can do them. You don't need a 20-person project with endless procedures and processes and meetings to create something valuable.

  • The apps are crisp and clean, focusing on what the user wants to do at a particular time and/or place. They're simple but not simplistic. This makes application design (and subsequent implementation) much easier and faster.

  • The free iPhone Software Development Kit (SDK) makes development as easy as possible. This All-in-One book reveals the SDK in all its splendor and glory. If you can't stand waiting, you could go on to Chapter 1 of Book III, register as an iPhone developer, and download the SDK . . . but (fair warning) jumping the gun leads to extra hassle. It's worth getting a handle on the ins and outs of iPhone app development beforehand.

The iPhone has three other advantages that are important to you as a developer:

  • The App Store. Apple will list your app in the App Store in the category you specify, and it will take care of credit-card processing, hosting, downloading, notifying users of updates, and all those things that most developers hate doing. Developers name their own prices for their creations; Apple gets 30 percent of the sales price, with the developer getting the rest.

  • Apple has an iPhone developer program. To get your app into the store, you have to pay $99 to join the program. (An enterprise pays $299.) But that's it. There are none of the infamous hidden charges that you often encounter, especially when dealing with credit-card companies. Go to the Apple iPhone Developer site (http://developer.apple.com/iphone/program) and click the Enroll Now button. Chapter 5 of this minibook describes how to work with the App Store to get your apps published.

  • It's a business tool. The iPhone has become an acceptable business tool, in part because it has tight security as well as support for Microsoft Exchange and Office. This happy state of affairs expands the possible audience for your application.

Developing with Apple's Expectations in Mind

Just as the iPhone can extend the reach of the user, the device possibilities and the development environment can extend your reach as a developer. It helps to understand Apple's perspective on what iPhone apps should be — the company clearly has done some serious thinking about it far longer than anybody else out there, having taken years to bring the iPhone to market under a veil of secrecy.

So what does Apple think? Spokespeople often talk about three different application styles:

  • Productivity applications use and manipulate information. The RoadTrip app is an example, and so are Travel Kit, Bento, Dropbox, Documents To Go, and Print n Share. Common to all these apps is the use and manipulation of multiple types of information. (I'm not talking about the Productivity category in the App Store — that's a marketing designation.)

  • Utility applications perform simple, highly defined tasks. The preinstalled Weather app is an example — it deals only with the weather data — and so is RedLaser, which scans barcodes. The DeepThoughts app is considered a utility, as it performs a simple, highly defined task. (Again, I'm not talking about the Utilities category in the App Store, although many of those apps are considered utility apps because they perform simple, highly defined tasks.)

  • Immersive applications are focused on delivering — and having the user interact with — content in a visually rich environment. A game is a typical example of an immersive application.

Although these categories help you understand how Apple thinks about iPhone apps (at least publicly), don't let them get in the way of your creativity. You've probably heard ad nauseam about stepping outside the box. But hold on to your lunch; the iPhone "box" isn't even a box yet. So here's a more extreme metaphor: Try diving into the abyss and coming up with something really new.

An Overview of the Development Cycle

To keep from drowning in that abyss, you need a plan to guide you through it. Socrates anticipated software development when he said that there's nothing stable in human affairs. Tacitus, with more data in hand 450 years later, saw that in all things there is a law of cycles. By the late 1960s, the Jefferson Airplane were singing, "go with the natural flow, like water off a spinning ball."

In plain words, your software development plan is a cycle; perhaps a vicious cycle, but it can be a cycle through the park. You may repeat procedures within the cycle iteratively until you get it right, but the key to understanding the cycle is the recognition that once you spin off version 1 of your app, you start all over again to develop an update.

In general terms, the software development cycle is the process of creating or altering a software product or service. Theorists have created models and methodologies for defining this cycle. Although there are at least half a dozen models (Neal's a recovering software development methodologist), the one I go through here is pretty simple and is well suited for the iPhone to boot. Here goes:

  1. Defining the problems

  2. Designing the user experience

    1. Understanding the real-world context

    2. Understanding the device context

    3. Categorizing the problems and defining the solutions

  3. Creating the program architecture

    1. A main view

    2. Content views

    3. View controllers

    4. Models

  4. Writing the code

  5. Doing it until you get it right

Of course, the actual analysis, design, and programming (not to mention testing) process has a bit more to it than this — and the specification and design definitely involve more than what you see in this book. But from a process perspective, it's pretty close to the real thing. It does give you an idea of the questions you need to ask — and have answered — in order to develop an effective iPhone application.

Note

A word of caution, though. Even though iPhone apps are smaller and much easier to get your head around than, say, a full-blown enterprise service-oriented architecture, they come equipped with a unique set of challenges. Between the iPhone platform limitations and the high expectation of iPhone users, you'll have your hands full.

The Sample Applications

It's hard enough to understand how to develop an app, and even harder if the first example you turn to is too complex to get your head around. The first sample app, DeepThoughts (shown in Figure 1-2), is simple enough to understand, and yet it demonstrates enough of the building blocks for creating a sophisticated app that you should have no trouble following along and building it. With a little more (although not much more) work, you can use the development environment to actually create something of value.

DeepThoughts displays whatever text you enter on the iPhone screen in a flowing animation supposedly suggesting a meditative state (as in "peace love groovy music"). It can also display a second page animated with whatever photo you select in the Photo library on your iPhone.

This book will provoke Deep-Thoughts.

Figure 1-2. This book will provoke Deep-Thoughts.

After you know a bit more about the application design cycle and what makes a good user interface, and even more (actually quite a bit more) about the iPhone technologies that work behind the screen — such as frameworks, windows, views, and view controllers — and then just a few more details about getting your app ready for the App Store and the public, you're ready to plunge into Objective C, and do some coding — the DeepThoughts app.

After that, you find out about the design of the RoadTrip app, starting in Book V. You find out how to use table views (like the ones you see in the Contacts, iPod, Mail, and Settings apps that come with the iPhone); access data on the Web; go out to (and return from) Web sites while staying in your app; store data in files; include data with your app; allow users to set preferences; and even how to resume your app where the user last left off. The book even covers localization and self-configuring controllers and models. (Don't worry; by the time you get there, you'll know exactly what they mean.) And Book V shows you how easy it is to create a map (in RoadTrip) that is tailored to the needs of the users based on what they are doing and where they are.

What's Next

You must be raring to go now and just can't wait to download the Software Development Kit (SDK) from the iPhone Developers Web site. That's exactly what many new developers do — and later are sorry that they didn't spend more time upfront understanding the iPhone user experience, how applications work in the iPhone environment, and the guidelines that Apple enforces for apps to be approved for the App Store.

So be patient. The following chapters of Book I cover all the aspects of development you need to know before you spend time coding. Then, I promise, it's off to the races.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.21.247.16