Standford CS 193P: 01-Introduction

Preview:

Citation preview

Welcome to CS193PiPhone Application Development

Evan Dolledoll@stanford.edu

Paul Marcospmarcos@stanford.edu

1Tuesday, September 23, 2008

Introductions

• Lecturers■ Paul Marcos <pmarcos@stanford.edu>■ Evan Doll <edoll@stanford.edu>

• Student TAs■ Troy Brant <troyb@stanford.edu>■ Kayvon Beykpour <beykpour@stanford.edu>

• Industry “TAs”■ Adam Nash <smashman@stanford.edu>■ Joe Bernstein <joe@terriblyclever.com>

2Tuesday, September 23, 2008

Quick Survey• Have worked with Java or C++?• Have an Intel-based Macintosh?• Have done Mac OS X development?• Have installed the iPhone SDK and done iPhone

development?

3Tuesday, September 23, 2008

Logistics• Lectures: Packard 101

Tues & Thurs 12:50 - 2:05 PM• Prerequisite: CS 106B/X• Recommended Book: None, we’ll use Apple documentation• Required Hardware:

■ You must have access to an Intel-based Macintosh

• Required Software: ■ Mac OS X 10.5.4 Leopard (or later)■ iPhone SDK

• iPhone SDK is not currently available on cluster computers

4Tuesday, September 23, 2008

Office Hours & Web Site• Office hours

■ TBD, will be posted on web site and via email

• Email■ cs193p@cs.stanford.edu

• Web site■ http://cs193p.stanford.edu■ Access restricted to some materials

5Tuesday, September 23, 2008

Enrollment• Response has been phenomenal!• Enrollment limited to 50 students• You MUST fill out a survey to be considered

■ http://tinyurl.com/CS193P■ Need to be completed by noon tomorrow (8/24)

• Priority will be given as follows:■ completed CS106B/X and 108 (or equiv. industry experience)■ prior C and OOP experience■ students close to graduating■ CS majors

• If you don’t get enrolled, you are welcome to audit■ You must inform us that you’re auditing

6Tuesday, September 23, 2008

Why Are We Here?

To build iPhone & iPod touch applications using Cocoa Touch

7Tuesday, September 23, 2008

Why Are We Here?• 193P is not just about the iPhone, Cocoa Touch or ObjC• It’s about Software Engineering, as well as object oriented

architecture and design• Exposure to problems and solutions that you might not see in

other classes

8Tuesday, September 23, 2008

Stanford iPhone Pilot• Applications by Stanford students for Stanford students• Project information:

■ http://studentapps.stanford.edu/iapps.html

• Details on the current applications■ http://stanford.terriblyclever.com

• Contact Joe and Kayvon for more details about the program• Keep in mind for final projects

9Tuesday, September 23, 2008

Cocoa Touch & iPhone SDK• The Good

■ Based on Cocoa which is mature, well thought out with highly consistent APIs

■ Provides a very rich starting point for exploring app design■ Shows “real-world” implementations of OO design patterns■ Designs learned on iPhone translate directly to Mac OS X

• The Bad■ 1.0 version of SDK, bound to be some rough edges■ Exploring new territory with classroom device development

• The Ugly■ iPhone developer agreement

10Tuesday, September 23, 2008

Buzz about the class• Bloggers asked, “How can they teach the class with Apple’s

NDA?”

“Basically, it's like Fight Club.

Once you enroll in the iPhone developer program, you're not allowed to talk about the developer program, the SDK, or pretty much anything until Apple says it's OK.”

11Tuesday, September 23, 2008

iPhone Developer University Program• Some materials for the class still covered by confidentiality

clause■ Existing iPhone developer program restricts who developers can

talk to about SDK details■ University program allows schools to create teams of students

who can talk to each other, exchange applications, etc.

• Students will be “invited” to join our CS193P team■ Accepting invitation includes agreeing to honor these terms

• Once accepted, you can download the SDK…and we can talk

12Tuesday, September 23, 2008

R STUDENTS STRONGLY CAUTIONED

SOME MATERIAL MAY BE INAPPROPRIATE FOR STUDENTS WHO HAVE NOT ACCEPTED THE UNIVERSITY AGREEMENT

For brief exposure to confidential API and details about iPhone OS. Do not discuss with anyone not enrolled in this class.

THIS CLASS HAS BEEN RATED

13Tuesday, September 23, 2008

Things We’ll Cover

14Tuesday, September 23, 2008

Xcode Interface BuilderTools

Language (& Runtime) Objective-C

[textView setStringValue: @“Hello”];

Frameworks

Foundation UIKit

15Tuesday, September 23, 2008

Why Objective-C?• Exposure to other languages is always good• ObjC is a language focused on simplicity and the elegance of

OO design■ Based on ANSI C■ Brings many object oriented principles, but with a minimal

amount of syntax

• A data point to compare with designs of C, C++ and Java

16Tuesday, September 23, 2008

Applications You Will Build

HelloStanford & Obj-C Tool

HelloPoly - 2 weeks

Presence - 4 weeks

Final Project (your choice) - 3 weeks

17Tuesday, September 23, 2008

Assignments, Grading & Late Policy• 7 weekly assignments• Final project of your choice

■ End of quarter demos at Apple...

• Grading: Nice & simple: ✓, ✓+ and ✓-• Late Policy: 3 late days, use them wisely!

18Tuesday, September 23, 2008

First Assignment• First assignment handed out today, 2 parts• Intended to get you situated with tools and start off with Obj-C• Includes a comprehensive walkthrough• We suggest trying to do Assignment 1A before Thursday to

help work out any tools or installation issues

19Tuesday, September 23, 2008

Second Assignment: Presence• Build a fully functional application from scratch over 4 weeks• Each assignment builds on the previous one

■ Don’t fall behind!

• Covers a wide variety of topics in the UIKit framework...

20Tuesday, September 23, 2008

PresenceBird’s Eye View

21Tuesday, September 23, 2008

What We’ll Cover• Application design patterns• View controllers• Presenting data

■ Table views

• Loading & saving data■ Property lists, SQLite, web services

• Text input• Performance tuning• Address Book and other system integration• More...? Suggestions welcome!

22Tuesday, September 23, 2008

Final Projects• 3 weeks to work on them• Application of your choice• It’s never too early to think of something and propose it to us• Categories to consider:

■ Student life apps■ Educational tools■ Games■ Social / location-aware software

• Find a project that you or your friends would actually like to use!

• Post it on the app store?

23Tuesday, September 23, 2008

Questions?

24Tuesday, September 23, 2008

iPhone OS Overview

25Tuesday, September 23, 2008

Media

Core Services

Core OS

Cocoa

Touch

Mac OS X

iPhone OS

iPhone

26Tuesday, September 23, 2008

Core Services

Collections Core Location

Address Book Net Services

Networking Threading

File Access Preferences

SQLite URL utilities

Media

Core Audio JPG, PNG, TIFF

OpenAL PDF

Audio Mixing Quartz (2D)

Audio Recording Core Animation

Video Playback OpenGL ES

Cocoa Touch

Multi-Touch Events Alerts

Multi-Touch Controls Web View

Accelerometer People Picker

View Hierarchy Image Picker

Localization Camera

Media

Core Services

Core OS

Cocoa Touch

iPhone OSCore OS

OS X Kernel Power Mgmt

Mach 3.0 Keychain

BSD Certificates

Sockets File System

Security Bonjour

27Tuesday, September 23, 2008

Xcode Interface BuilderTools

Language (& Runtime) Objective-C

[textView setStringValue: @“Hello”];

Frameworks

Foundation UIKit

28Tuesday, September 23, 2008

Cocoa Touch Architecture

Cocoa Touch

UIKit User interface elementsApplication runtimeEvent handlingHardware APIs

Foundation Utility classesCollection classesObject wrappers for system servicesSubset of Foundation in Cocoa

29Tuesday, September 23, 2008

Objects

30Tuesday, September 23, 2008

Thing

Object

31Tuesday, September 23, 2008

Thing

doSomething

Behavior

behavior

32Tuesday, September 23, 2008

Thing

doSomething

Message

"doSomething"

33Tuesday, September 23, 2008

Thingflagcount

doSomething

State

state

behavior

34Tuesday, September 23, 2008

Thingflagcount

doSomething

Other Objects As State

helperstate

doSomethingElse

Other Thing

performDifficultTask

behavior

35Tuesday, September 23, 2008

Controllersliderlabel

updateLabel

Outlets Need to decide what the demo would be and update slide to appropriate material.

- text field / slider?

- color tabs?

Need to decide what the demo would be and update slide to appropriate material.

- text field / slider?

- color tabs?

36Tuesday, September 23, 2008

Controllersliderlabel

updateLabel

Target / Action

targetaction ʻupdateLabelʼ

37Tuesday, September 23, 2008

Demo

38Tuesday, September 23, 2008

Outlets

Controllersliderlabel

updateLabel

39Tuesday, September 23, 2008

Target / Action

Controllersliderlabel

updateLabel

targetaction ʻupdateLabelʼ

40Tuesday, September 23, 2008

Questions?

41Tuesday, September 23, 2008