iPhone Development for
Experienced Web Developers
         SXSW 2009
Who We Are
• Joshua Siler, VP of Technology
• Jordan Lev, Senior Developer

http://www.bnj.com
(Relationship Marketing Age...
Poll

How many people here have
tried native iPhone app
development?
Poll

How many people here have
an online application that
might use an iPhone client?
Session Overview
•   Web developer POV
•   What’s different about iPhone dev
•   Our project, some design decisions
•   Co...
What’s Different
Web Developers…
are mad for POWER
iPhoneProcessor
• ~400mhz
  processor, 128mb
  RAM
• 10 to 100 times
  slower processor
  and memory
• Premature
  optimiz...
Web Latency
Web Latency
Web Latency
Web Latency
Web Latency
iPhone Latency
Latency Management
• Take latency into account during app design
• Asynchronous operations where anything
  takes any kind...
Tools
•   Must have an Intel powered Mac
•   $99 to join Apple Developer Program
•   Free SDK download, Xcode, Objective C...
TIOBE Programming Community Index
TIOBE Programming Community Index
Objective C
• C with OO added
• Totally different than typical Web Languages
  – Pointers
  – Memory Management
     • No ...
Xcode
Cocoa
• Objective C all low level
• Cocoa is really great
Coming Soon
Our Project
CP Screenshot
Protocols
•   https for secure data transfer
•   Username and password authenticated
•   REST web services interface
•   J...
Web Services SOAP (google)
<?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?>
<SOAP-ENV:Envelope
 SOAP-ENV:encodingSty...
Web Services REST (amazon)
http://rcm.amazon.com/e/cm?t=[Associates ID goes here]
&l=st1&search=[subject keyword goes here...
Web Services
• Lightweight approach for mobile is critical
• REST interfaces far more efficient
• JSON for returned data
 ...
Architecture Diagram                             Web


                    https; GET websites
 Retrieve List of          ...
App Demo and Mini-Tutorial
Concepts
• MVC
• Events and Delegates
• Interface Builder
Lay of the Land
• AppDelegate
  – (initialization)
• ViewController
  – (one per page)
     • + XIB
• Data Models
Pseudocode
Screen loads
• Controller asks model for data
• Make http request
• Parse JSON (convert it to objects)
• Displ...
Pseudocode
Screen loads
Controller asks model for data
• Make http request
• Parse JSON (convert it to objects)
• Displa...
Pseudocode
Screen loads
Controller asks model for data
Make http request
• Parse JSON (convert it to objects)
• Display...
Pseudocode
Screen loads
Controller asks model for data
Make http request
Parse JSON (convert it to objects)
• Display ...
Pseudocode
Screen loads
Controller asks model for data
Make http request
Parse JSON (convert it to objects)
Display d...
Pseudocode
Screen loads
Controller asks model for data
Make http request
Parse JSON (convert it to objects)
Display d...
Memory Management
• Golden Rule
  – If you alloc/init it, you have to release it.
     • If you’re returning it from a met...
Compiling, Testing, Distributing
• Apple developer account required to deploy
  to iPhone
• Simulator can be different tha...
What We Think
Really Like about iPhone Development
• Incomparable/exciting platform
• Standardized hardware, relatively powerful
  devic...
Really Don’t’ Like
• Objective C, iPhone application model
  – Lots of assumed knowledge and undocumented rules
    to dis...
Q&A
iPhone Development For Experienced Web Developers
iPhone Development For Experienced Web Developers
Upcoming SlideShare
Loading in …5
×

iPhone Development For Experienced Web Developers

1,472 views

Published on

Published in: Technology, News & Politics
  • Be the first to comment

iPhone Development For Experienced Web Developers

  1. 1. iPhone Development for Experienced Web Developers SXSW 2009
  2. 2. Who We Are • Joshua Siler, VP of Technology • Jordan Lev, Senior Developer http://www.bnj.com (Relationship Marketing Agency) A few of our clients:
  3. 3. Poll How many people here have tried native iPhone app development?
  4. 4. Poll How many people here have an online application that might use an iPhone client?
  5. 5. Session Overview • Web developer POV • What’s different about iPhone dev • Our project, some design decisions • Code review and mini-tutorial
  6. 6. What’s Different
  7. 7. Web Developers… are mad for POWER
  8. 8. iPhoneProcessor • ~400mhz processor, 128mb RAM • 10 to 100 times slower processor and memory • Premature optimization takes on a different meaning * http://www.primatelabs.ca/blog/2007/08/gee
  9. 9. Web Latency
  10. 10. Web Latency
  11. 11. Web Latency
  12. 12. Web Latency
  13. 13. Web Latency
  14. 14. iPhone Latency
  15. 15. Latency Management • Take latency into account during app design • Asynchronous operations where anything takes any kind of time • Explicitly define wait indicators • Multithreaded considerations
  16. 16. Tools • Must have an Intel powered Mac • $99 to join Apple Developer Program • Free SDK download, Xcode, Objective C, Cocoa • http://developer.apple.com
  17. 17. TIOBE Programming Community Index
  18. 18. TIOBE Programming Community Index
  19. 19. Objective C • C with OO added • Totally different than typical Web Languages – Pointers – Memory Management • No garbage collection – Non-linear code execution – Syntactical… saltiness? • Language features seem years behind • Biggest burden to new non-Mac developers
  20. 20. Xcode
  21. 21. Cocoa • Objective C all low level • Cocoa is really great
  22. 22. Coming Soon
  23. 23. Our Project
  24. 24. CP Screenshot
  25. 25. Protocols • https for secure data transfer • Username and password authenticated • REST web services interface • JSON for returning data
  26. 26. Web Services SOAP (google) <?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?> <SOAP-ENV:Envelope SOAP-ENV:encodingStyle=quot;http://schemas.xmlsoap.org/soap/encoding/quot; xmlns:SOAP-ENC=quot;http://schemas.xmlsoap.org/soap/encoding/quot; xmlns:xsi=quot;http://www.w3.org/1999/XMLSchema-instancequot; xmlns:SOAP-ENV=quot;http://schemas.xmlsoap.org/soap/envelope/quot; xmlns:xsd=quot;http://www.w3.org/1999/XMLSchemaquot; > <SOAP-ENV:Header> <developer_emailxsi:type=quot;xsd:stringquot; SOAP-ENC:root=quot;1quot;>INSERT_DEVELOPER_EMAIL_HERE</developer_email> <display_localexsi:type=quot;xsd:stringquot; SOAP-ENC:root=quot;1quot;>en_US</display_locale> <developer_passwordxsi:type=quot;xsd:stringquot; SOAP-ENC:root=quot;1quot;>INSERT_PASSWORD_HERE</developer_password> </SOAP-ENV:Header> <SOAP-ENV:Body> <ns1:associateAccount xmlns:ns1=quot;http://www.google.com/api/adsense/v3quot; SOAP-ENC:root=quot;1quot;> <loginEmail>INSERT_PUBLISHER_EMAIL_HERE</loginEmail> <postalCode>12345</postalCode> <phone xsi:nil=quot;1quot;/> <developerUrl>INSERT_DEVELOPER_URL_HERE</developerUrl> </ns1:associateAccount> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
  27. 27. Web Services REST (amazon) http://rcm.amazon.com/e/cm?t=[Associates ID goes here] &l=st1&search=[subject keyword goes here] &mode=[product line goes here] &p=102&o=1&f=xml
  28. 28. Web Services • Lightweight approach for mobile is critical • REST interfaces far more efficient • JSON for returned data – Allows you to serialize objects with known data and types – Can be 100x faster to parse than XML – Significantly fewer control characters and other overhead – Platform independent, easy to consume – http://www.json.org
  29. 29. Architecture Diagram Web https; GET websites Retrieve List of Provide List of JSON result, [[name,id]…] Projects Websites Auth https; GET websites?id= Provide Data for Retrieve Data for JSON result, [[key,value]…] Website Project Edit/Enter Username and Password Local Storage
  30. 30. App Demo and Mini-Tutorial
  31. 31. Concepts • MVC • Events and Delegates • Interface Builder
  32. 32. Lay of the Land • AppDelegate – (initialization) • ViewController – (one per page) • + XIB • Data Models
  33. 33. Pseudocode Screen loads • Controller asks model for data • Make http request • Parse JSON (convert it to objects) • Display data • Wait for additional events (e.g. button click): repeat process with new page
  34. 34. Pseudocode Screen loads Controller asks model for data • Make http request • Parse JSON (convert it to objects) • Display data • Wait for additional events (e.g. button click): repeat process with new page
  35. 35. Pseudocode Screen loads Controller asks model for data Make http request • Parse JSON (convert it to objects) • Display data • Wait for additional events (e.g. button click): repeat process with new page
  36. 36. Pseudocode Screen loads Controller asks model for data Make http request Parse JSON (convert it to objects) • Display data • Wait for additional events (e.g. button click): repeat process with new page
  37. 37. Pseudocode Screen loads Controller asks model for data Make http request Parse JSON (convert it to objects) Display data • Wait for additional events (e.g. button click): repeat process with new page
  38. 38. Pseudocode Screen loads Controller asks model for data Make http request Parse JSON (convert it to objects) Display data Wait for additional events (e.g. button click): repeat process with new page
  39. 39. Memory Management • Golden Rule – If you alloc/init it, you have to release it. • If you’re returning it from a method, autorelease it. – If you’re NOT alloc/init’ing it, do NOT release it! • Mostly… • Finding leaks – Use “Instruments” application.
  40. 40. Compiling, Testing, Distributing • Apple developer account required to deploy to iPhone • Simulator can be different than actual device operation, be sure to QA thoroughly • Be prepared for a lengthy process of registering, signing, deploying and obtaining approval for your app
  41. 41. What We Think
  42. 42. Really Like about iPhone Development • Incomparable/exciting platform • Standardized hardware, relatively powerful device • Cocoa and MVC paradigm • “Bare metal” programming is a refreshing change of pace
  43. 43. Really Don’t’ Like • Objective C, iPhone application model – Lots of assumed knowledge and undocumented rules to discover – Refactoring is difficult • Xcode – Code editor with GCC config… have come to expect more • App deployment • Flaky connectivity • Apple controlled domain
  44. 44. Q&A

×