June 29, 2007
2 Quad Core
Processors @ 3.0GHz
1 Single Core
Processor @ 412 MHz
1GB - 32GB RAM 128MB RAM
Gigabit Ethernet Edge & WiFi
Up to 8
2560x1600 Displays
One 3½ Inch
320x480 Display
Slide 3
Slide 3 text
Mobile Constraints
Limited Memory
Slow Processor
Battery Life
Slow Network
Small Screen
Slide 4
Slide 4 text
iOS
Beware of Watchdog
• Watchdog is a process
that ensures apps play
nice within these
constraints.
• It will kill your app if it
takes up too many
resources. animalsbeingdicks.com
Slide 5
Slide 5 text
Limited Memory
Slow Processor
Battery Life
Slow Network
Small Screen
Slide 6
Slide 6 text
Limited Memory
• On iOS, there’s no swap file.
• 20MB*, you get memory warnings.
• 30MB*, watchdog kills your app.
*These can vary based on device, apps running, etc…
Slide 7
Slide 7 text
Limited Memory
• Always test on the device:
• Simulator doesn’t have
memory constraints.
• Profile memory usage:
• “Allocations” instrument on iOS
• iOS - Check for memory leaks
Test
Slide 8
Slide 8 text
Limited Memory
• Cache judiciously:
• NSCache on iOS.
• getCacheDir() on Android.
• Download large files directly to disk:
• NSFileHandle on iOS
• DownloadManager on Android
Tips
Slow Processor
Low Memory
Battery Life
Slow Network
Small Screen
Slide 11
Slide 11 text
Slow Processor
• Complex operations will take more time.
• Long operations can block the UI.
• iOS - Watchdog will kill an app if it blocks
the main thread for > 30 seconds.
• Exception: 0x8badf00d (ate bad food).
Slide 12
Slide 12 text
Slow Processor
• Test on Device:
• iOS - Simulator will run at
native processor speed.
• Profile slow code:
• iOS - “Timer Profiler” instrument.
• View methods by time how long they
take.
Test
Slide 13
Slide 13 text
Slow Processor
• Familiarize yourself with concurrency:
• iOS - NSOperation.
• iOS - Grand Central Dispatch.
• Android - AsyncTask.
• Both Android and iOS have specific threads
that UI updates must be called on.
Tips
Slide 14
Slide 14 text
Battery Life
Low Memory
Slow Processor
Slow Network
Small Screen
Slide 15
Slide 15 text
Battery Life
Slide 16
Slide 16 text
Battery Life
• This is a major issue with many factors:
• CPU/GPU usage.
• Antennas: Cellular, WiFi, GPS, Bluetooth.
• Screen Brightness.
• etc…
Slide 17
Slide 17 text
Battery Life
• iOS - You can test this!
• Profile with the “Energy
Diagnostics” instrument.
• Always profile while on battery power!
• See “Instruments User Guide” for more
details
Test
Slide 18
Slide 18 text
Battery Life
Test
Slide 19
Slide 19 text
Slow Network
Low Memory
Slow Processor
Small Screen
Battery Life
Slide 20
Slide 20 text
Slow Network
• User may have a super
slow network connection.
• User may not even have a network
connection.
• User may often often lose connection.
• Most users may have a cellular data cap!
Slide 21
Slide 21 text
Slow Network
• Hard to test all network situations.
• Do real world testing as much as
possible.
• iOS - Network Link Conditioner
system preference can simulate
different network conditions.
Test
Slide 22
Slide 22 text
Slow Network
• Don’t assume anything about the network
connection.
• Fail Gracefully. It will fail for someone.
• Avoid UI blocking networking:
• iOS - sendSynchronousRequest
Tips
Slide 23
Slide 23 text
Small Screen
Low Memory
Slow Processor
Slow Network
Battery Life
Slide 24
Slide 24 text
Small Screen
• Expect screens between 3½ and 5 inches.
• Fingers are larger and less precise than
mice:
• iOS - 44 square points recommended for
controls.
Slide 25
Slide 25 text
Small Screen
• Always do user testing.
• User may interact through accessibility
controls:
• Test these too!
Test
Slide 26
Slide 26 text
Small Screen
• Re-prioritize what is important & keep only
what is needed.
• Minimize screen space used for branding or
unnecessary elements.
• Grouping & hierarchy become very
important:
• iOS - UINavigationController
Tips
Slide 27
Slide 27 text
Small Screen
• Hide controls when they’re not needed
• Find interesting uses for gestures
• Scrolling and panning is fun. Take advantage
of it. (e.g. Twitter)
Tips
Slide 28
Slide 28 text
Mobile Constraints
Limited Memory
Slow Processor
Battery Life
Slow Network
Small Screen
Slide 29
Slide 29 text
Embrace these
Constraints
Slide 30
Slide 30 text
Why?
“…more iOS devices were sold in 2011…
than all the Macs ever sold”
- asymco.com
“There are more Android activations every
day than babies born on earth”
- Robert Kyncl, YouTube
Slide 31
Slide 31 text
Why?
Mobile is popular!
It is just beginning to bloom.
It is leading innovation…
despite these constraints.