+ All Categories
Home > Technology > iPhone Development For Experienced Web Developers

iPhone Development For Experienced Web Developers

Date post: 11-Apr-2017
Category:
Upload: lisab517
View: 1,438 times
Download: 2 times
Share this document with a friend
46
iPhone Development for Experienced Web Developers SXSW 2009
Transcript
Page 1: iPhone Development For Experienced Web Developers

iPhone Development for Experienced Web Developers

SXSW 2009

Page 3: iPhone Development For Experienced Web Developers

Poll

How many people here have tried native iPhone app development?

Page 4: iPhone Development For Experienced Web Developers

Poll

How many people here have an online application that might use an iPhone client?

Page 5: iPhone Development For Experienced Web Developers

Session Overview

• Web developer POV• What’s different about iPhone dev• Our project, some design decisions• Code review and mini-tutorial

Page 6: iPhone Development For Experienced Web Developers

What’s Different

Page 7: iPhone Development For Experienced Web Developers

Web Developers… are mad for POWER

Page 8: iPhone Development For Experienced Web Developers

iPhone Processor• ~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/geekbench-2-for-the-iphone/

Page 9: iPhone Development For Experienced Web Developers

Web Latency

Page 10: iPhone Development For Experienced Web Developers

Web Latency

Page 11: iPhone Development For Experienced Web Developers

Web Latency

Page 12: iPhone Development For Experienced Web Developers

Web Latency

Page 13: iPhone Development For Experienced Web Developers

Web Latency

Page 14: iPhone Development For Experienced Web Developers

iPhone Latency

Page 15: iPhone Development For Experienced Web Developers

Latency Management

• Take latency into account during app design• Asynchronous operations where anything

takes any kind of time• Explicitly define wait indicators• Multithreaded considerations

Page 16: iPhone Development For Experienced Web Developers

Tools

• Must have an Intel powered Mac• $99 to join Apple Developer Program• Free SDK download, Xcode, Objective C, Cocoa• http://developer.apple.com

Page 17: iPhone Development For Experienced Web Developers

TIOBE Programming Community Index

Page 18: iPhone Development For Experienced Web Developers

TIOBE Programming Community Index

Page 19: iPhone Development For Experienced Web Developers

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

Page 20: iPhone Development For Experienced Web Developers

Xcode

Page 21: iPhone Development For Experienced Web Developers

Cocoa

• Objective C all low level• Cocoa is really great

Page 22: iPhone Development For Experienced Web Developers

Coming Soon

Page 23: iPhone Development For Experienced Web Developers

Our Project

Page 24: iPhone Development For Experienced Web Developers

CP Screenshot

Page 25: iPhone Development For Experienced Web Developers

Protocols

• https for secure data transfer• Username and password authenticated• REST web services interface• JSON for returning data

Page 26: iPhone Development For Experienced Web Developers

Web Services SOAP (google)<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/1999/XMLSchema"><SOAP-ENV:Header> <developer_email xsi:type="xsd:string" SOAP-ENC:root="1">INSERT_DEVELOPER_EMAIL_HERE</developer_email> <display_locale xsi:type="xsd:string" SOAP-ENC:root="1">en_US</display_locale> <developer_password xsi:type="xsd:string" SOAP-ENC:root="1">INSERT_PASSWORD_HERE</developer_password></SOAP-ENV:Header><SOAP-ENV:Body> <ns1:associateAccount xmlns:ns1="http://www.google.com/api/adsense/v3" SOAP-ENC:root="1"> <loginEmail>INSERT_PUBLISHER_EMAIL_HERE</loginEmail> <postalCode>12345</postalCode> <phone xsi:nil="1"/> <developerUrl>INSERT_DEVELOPER_URL_HERE</developerUrl> </ns1:associateAccount></SOAP-ENV:Body></SOAP-ENV:Envelope>

Page 27: iPhone Development For Experienced Web Developers

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

Page 28: iPhone Development For Experienced Web Developers

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

Page 29: iPhone Development For Experienced Web Developers

Architecture Diagram

Auth

Provide List of Websites

Provide Data for Website

Local Storage

Retrieve List of Projects

Retrieve Data for Project

Edit/Enter Username and

Password

Web

https; GET websites

JSON result, [[name,id]…]

https; GET websites?id=

JSON result, [[key,value]…]

Page 30: iPhone Development For Experienced Web Developers

App Demo and Mini-Tutorial

Page 31: iPhone Development For Experienced Web Developers

Concepts

• MVC• Events and Delegates• Interface Builder

Page 32: iPhone Development For Experienced Web Developers
Page 33: iPhone Development For Experienced Web Developers

Lay of the Land

• AppDelegate– (initialization)

• ViewController– (one per page) • + XIB

• Data Models

Page 34: iPhone Development For Experienced Web Developers

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

Page 35: iPhone Development For Experienced Web Developers

Pseudocode

Screen loadsController 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

Page 36: iPhone Development For Experienced Web Developers

Pseudocode

Screen loadsController asks model for dataMake http request• Parse JSON (convert it to objects)• Display data• Wait for additional events (e.g. button click):

repeat process with new page

Page 37: iPhone Development For Experienced Web Developers

Pseudocode

Screen loadsController asks model for dataMake http requestParse JSON (convert it to objects)• Display data• Wait for additional events (e.g. button click):

repeat process with new page

Page 38: iPhone Development For Experienced Web Developers

Pseudocode

Screen loadsController asks model for dataMake http requestParse JSON (convert it to objects)Display data• Wait for additional events (e.g. button click):

repeat process with new page

Page 39: iPhone Development For Experienced Web Developers

Pseudocode

Screen loadsController asks model for dataMake http requestParse JSON (convert it to objects)Display dataWait for additional events (e.g. button click):

repeat process with new page

Page 40: iPhone Development For Experienced Web Developers

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.

Page 41: iPhone Development For Experienced Web Developers
Page 42: iPhone Development For Experienced Web Developers

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

Page 43: iPhone Development For Experienced Web Developers

What We Think

Page 44: iPhone Development For Experienced Web Developers

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

Page 45: iPhone Development For Experienced Web Developers

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

Page 46: iPhone Development For Experienced Web Developers

Q & A


Recommended