Tuesday, June 22, 2010

5 Billion apps downloaded. And counting.

When I was at WWDC 2010 a couple weeks ago, I took a picture of this synchronized cinema display that shows the activity of the 50,000 most popular App Store apps. Each app falls when downloaded and is sorted based on the color of its icon. It takes 10,800 apps to fill the display completely. The most frequent apps that were downloaded were Facebook and Twitter... both blue.


How did Apple do it?
"This hyperwall is powered by 30 Mac Pro towers with Mac OS X Snow Leopard and EVGA NVIDIA GTX 285 graphics cards. As apps are downloaded from the App Store, their data is coalesced via an XML feed every five minutes. Apps are sorted and scheduled using Cocoa and Objective-C. The data is then passed to an OpenCL Kernel, which drives the animation. Quartz Composer brings all the technologies together and renders the final synchronized output using Quartz Composer Visualizer."

Friday, June 11, 2010

iPhone & iPad User Interface Design: Mimic the real world

In iPad and iPhone design, you have to remember that everything wants to be touched. Anything that is touched needs to be instantaneously responsive. If it is not responsive, then it just won't feel right. There needs to be feedback, and it needs to feel rich, quick and real. Feedback is one of the most important elements of user interface design, and can come in the form of sounds, alerts, text messages, and animations.

As a developer, you should strive to mimic the real world. If you're creating an application that contains notes in a binder, consider using textures like black leather, steel rings, and white binder paper. If there is text on the paper that can be erased, consider showing eraser residue until the user is done pressing the back button on the device. If you're on the iPad, then each finger swipe to go to the next page can actually look like you're flipping a real page in a book.

Now don't let the feedback mechanisms, like animation, get in the way of the usability of your application. Animations, for example, need not be gratuitous. You should find the right balance between interesting, meaningful, and appropriate when using animations. Moreover, try to prevent the user from typing wherever possible. If you know the user's location, don't make them type it in. Make your users pick from a list instead of forcing them to type. This will make your user's life easier.

Lastly, iterate on your UI and ask yourself "how can I make this better?" You may think that you've completed most of the UI in your application, and it all feels right. However, you may add another feature, which will no longer cooperate with your existing UI. In this case, you'll have to hit the drawing board again, but as painful as that is, it keeps your application from becoming stale!

Multitasking on the iPhone

With iPhone SDK for iOS 4, fast app switching is the crux of multitasking. Fast app switching is when the application's state is preserved, and can immediately resume when the application becomes active. Although it is enabled by default, it requires tight integration with the multitasking UI.

There are four states in fast app switching: active, inactive, running, and suspended. Suppose you have Maps open on your iPhone. When you press the home button, your application's state is preserved and the applicationWillResignActive callback is sent to the delegate, telling the delegate that your application is now becoming inactive. Once the application has become inactive, an applicationDidEnterBackground callback is sent to the delegate, telling the delegate that your application is now entering the background. Shortly thereafter, the application moves into a suspended state, and no indication is given to the delegate in this case. Now suppose you hit the Maps icon again, at that point your Maps application comes out of the suspended state, enters the active state (applicationWillEnterForeground), and at last enters the running state (applicationDidBecomeActive). If for some reason, the application fails to preserve state and suspend itself, or if the application fails to launch, an applicationWillTerminate callback is sent to the delegate.

iOS also supports background execution for task finishing (extra time to complete a task), audio (play music), location (use GPS), and VoIP (make and receive calls). To use background execution for those four items, you'll need an explicit declaration in your app's info plist.

Here is a list of responsibilities and best practices when multitasking on the iPhone:
  • Save the app state incrementally.

  • Reduce memory usage and flush caches of data that can be regenerated: The system terminates apps when the memory exhausted. Using less memory allows more apps to remain alive, and increases the chance of your app staying alive. You'll want to reduce memory in the applicationDidEnterBackground callback.

  • Free backing graphic stores: Views and layers are backed by backing stores and view controllers. Of course, there is a trade off between recreating views and memory savings. When deemed appropriate, release non-visible UIViewController views, and flush [UIImage ImageNamed] cache. Release images [myImage release];
  • ImageNamed cache will repopulate lazily as images are requested during app state restore.
  • Do NOT use the GPU: It is off limits in the background. For example, creating an EAGLContext or issuing OpenGL commands will result in termination. When you enter the background, stop your GPU usage (stop using OpenGL altogether).

  • Consider memory mapping: Read-only memory can be reclaimed without terminating the app.

  • Pause your app when appropriate, and update the UI to show the change. This is typically performed in applicationDidResignActive.

  • Remove alerts and actionsheets if appropriate (via code)
  • Prepare for the application screenshot: The system takes a screenshot of your application. It is used when your application is animating back to the running state. You'll want to hide sensitive information and stop animations before the screenshot is taken.
  • System change notifications are not delivered to suspended applications. The notifications will coalesce into a notification queue. When the app is resume, then all the notifications will be delivered all at once. Therefore, prepare your app to handle bursts of notifications. Avoid delaying app responsiveness, and avoid rapid UI updates.
  • Handle errors and reestablish connections: When the suspended application resumes, the application must be prepared for lost network connections.
  • Holding exclusive access to shared data while suspended is not allowed. It results in termination, and is enforced upon entry to the suspended state.

For more information, consult the iPhone OS Programming Guide.

My source of knowledge: WWDC 2010 session on adopting multitasking on the iPhone

    Tuesday, April 20, 2010

    Landing Page Optimization

    Landing pages are used for internet marketing, and can help persuade users to become customers of your product or service. A good landing page consists of a clear headline, a phone number (to gain trust), avoids cheap advertisements like "BUY NOW!", shows credible images, and is thoroughly tested for broken links and mixed messages.

    Let's play a game. Give yourself 7 seconds to study the landing page below. In 7 seconds, you should be able to answer:

    1. Who is the company?
    2. What are they selling?
    3. What is the offer?
    4. What is the call to action (what do they want you to do)?



    If you weren't able to answer all the questions in 7 seconds, that's OK because this is an example of a bad landing page! Why is it bad? Well, is the company Google or Verizon or Motorola? What is the call to action? Do they want me to share apps or buy a Droid? If you look at the site for longer than 7 seconds, then of course you'll be able to answer these questions. Unfortunately, users do not give a new site longer than 7 seconds.

    Now, give yourself 7 seconds again for the page below.



    You should be able to answer all four questions for this page, because this is an example of a good landing page! The company is Apple. They're selling an iPad starting at $499. They want you to buy an iPad.

    Now that we have seen bad vs. good landing pages, let's take a look at how we can test and measure that our landing page is doing its job. Landing page optimization (also known as conversion rate optimization) measures the effectiveness of a landing page by observing how often people visit the page and do whatever you want them to do. There are a few things that you can do to test and measure the effectiveness of your landing page:

    1. Install a website optimizer to collect data. Google's website optimizer is very easy to use. All you have to do is take the Javascript tags that they give you and insert that into the pages you want to track.

    2. Validate your decisions with A/B testing. In A/B testing, you would write two versions of your landing page. If there are 1000 visitors, you would send 500 to site A, and 500 to site B. Based on which site produces the highest conversion rate, you would publish that site.

    3. Test primary images, call to action, headlines, buttons.

    .

    Thursday, June 28, 2007

    Uncaught Exceptions in Xcode

    Do you receive internal errors due to uncaught exceptions in Xcode? Here is how to find the root of the problem:

    1. Start Xcode under GDB and throw a breakpoint on -[NSException raise:]

    2. Also throw a breakpoint on objc_exception_throw, since @throw generates that, and doesn't necessarily call through -[NSException raise]. Between the two though you'll cover all your bases!

    .