wednesday 2-4, kh 105 comp 446 / elec 446 mobile wireless services project scott cutler professor in...

24
Wednesday 2-4, KH 105 COMP 446 / ELEC 446 Mobile Wireless Services Project Scott Cutler Professor in the Practice of Computer Technology Department of Computer Science Department of Electrical and Computer Engineering [email protected] 9/15/10

Upload: clifton-jeffs

Post on 16-Dec-2015

213 views

Category:

Documents


0 download

TRANSCRIPT

Wednesday 2-4, KH 105

COMP 446 / ELEC 446

Mobile Wireless Services Project

Scott CutlerProfessor in the Practice of Computer TechnologyDepartment of Computer ScienceDepartment of Electrical and Computer [email protected]/15/10

COMP 446 / ELEC 446 - Week 4 2

Today’s Agenda

Events of the week

Announcements / Infrastructure Updates

Memory Management Review

Last Week’s assignments

Website 101

Next Week Assignment 3 due by 9/23/2009

SEC - 9/15/10

COMP 446 / ELEC 446 - Week 4 4

AppNation Conference

Dedicated conference towards App creation App Revenue:

2009: $ 4.1 Billion 2012: $17.5 Billion

App Downloads: 2009: 7 Billion 2010: 50 Billion

Source – NBC news report

SEC - 9/15/10

COMP 446 / ELEC 446 - Week 2 5

Current Roster Julia Botev

COMP, SR, McMurtry [email protected] Eric Cheng

COMP, GR [email protected] Jesus Cortez

COMP, JR, Jones [email protected] Graham De Wit

ELEC, SR, Wiess [email protected] Ashley Herron

ELEC, SR, Martel [email protected] Tara Hong

ELEC, SR, Will Rice [email protected] Vic Hu

ELEC, SR, Wiess [email protected] Marcos Hung

BIOE, GR [email protected]

SEC - 9/01/10

COMP 446 / ELEC 446 - Week 2 6

Current Roster (2) Jin Kim

COMP, GR [email protected] Kevin Lin

COMP, SO, McMurtry [email protected] Robyn Moscowitz

COMP, JR, McMurtry [email protected]

Norman Pai ELEC, SR, Hanszen [email protected]

Josh Rykowski COMP, GR [email protected]

Ivan Van COMP, SR, Will Rice, [email protected]

Jeff Yeh ELEC, SR, Hanszen [email protected]

Aron Yu ELEC, SR, Hanszen [email protected]

SEC - 9/01/10

COMP 446 / ELEC 446 - Week 2 7

Current Roster (3) Michael Lo

ELEC, GR [email protected] Elliot Ng

ELEC, GR [email protected] Rick Manning

COMP, SR, Jones [email protected] Henry Zhang

ELEC, SR, Jones [email protected] Jason Xu

ELEC, SR, Brown [email protected] Catherine Elder

ELEC, SR, Hanszen [email protected]

SEC - 9/01/10

COMP 446 / ELEC 446 - Week 2 8

Current Roster (4) Sid Byrd

Staff [email protected] Xiang ‘Jash’ Guo

ELEC, GR [email protected] Wenyang Wu

CS, GR [email protected] Zhe Ren

CS, GR [email protected]

SEC - 9/01/10

COMP 446 / ELEC 446 - Week 2 9

COMP 446 Syllabus 8/25/10 Introduction / What makes mobile apps special

Assignment: Load Visual Studio – Due 8/30/10, Access a Mac, Download CS193P materials

9/1/10 Intro to Mac OS X and Cocoa Touch, Objective-C, Dev Tools, Using Objective-C, Foundation framework Videos: Lecture 1. Introduction to Mac OS X, Cocoa Touch, Objective-C and Tools (January 5, 2010)

Lecture 2. Objective-C and Foundation Framework (January 7, 2010) Assignment: Hello Rice [1a] and WhatATool 1 [1b] (Due 9/7/10)

9/8/10 Discussion of first applications Videos: Lecture 3. Custom Classes, Object Lifecycle, Autorelease, Objective-C Properties (January 12, 2010)

Lecture 4. Building an Application; Model, View, Controller; Nib Files; Controls and Target-Action (January 14, 2010)

Lecture 4a Xcode, Finding Help, Debugging (January 15, 2010) Assignment: WhatATool 2 [2a] and HelloPoly I [2b] (Due 9/14/10)

9/15/10 ASP.Net with a little HTML Videos: Lecture 5. Views, Drawing, and Animation (January 19, 2010)

Lecture 6. Designing iPhone Applications, Model-View-Controller, View Controllers (January 21, 2010) Assignment: HelloPoly II [3] (Due 9/21/10)

9/22/10 iPhone (pseudo) Web Apps / Browser Capabilities Videos: Lecture 7. Navigation & Tab Bar Controllers (January 26, 2010)

Lecture 8. Scroll Views and Table Views (January 28, 2010) Assignment: Paparazzi 1 (Due 9/28/10)

9/29/10 Creating and Consuming Web Services Videos: Lecture 9. Data in Your iPhone App (February 2, 2010)-

Lecture 10. Performance (February 4, 2010) Assignment: Paparazzi 2 (Due 10/05/10) (note that Paparazzi will not be considered late until 10/12/10;

You have 3 weeks to complete Paparazzi 2 and 3 but I need to have first submission of Paparazzi 2 by 10/05/10)

10/6/10 SQL 101 Videos: Lecture 11. Text Input and Presenting Content Modally (February 9, 2010)

Lecture 12. Web Views; Locations and Maps (February 11, 2010) Assignment: Paparazzi 3 (Due 10/19/10, but watch lectures prior to 10/13/10 class)

SEC - 9/01/10

COMP 446 / ELEC 446 - Week 2 10

COMP 446 Syllabus 10/13/10 iPad Development / iOS 4

Videos: Lecture 13. Address Book: Putting People in Your App (February 16, 2010)Lecture 14. Touch Events & Multi-touch (February 18, 2010)Lecture 12a: Designing for the iPad (February 12, 2010)

Assignment: Final Project Proposal (Due 10/19/10 along with Paparazzi 3)

10/20/10 Android 1 Videos: Lecture 15. iPhone Device APIs; Location, Accelerometer & Camera; Battery Life & Power Management

(February 23, 2010)Lecture 16. Audio APIs, Video Playback, Settings (February 25, 2010)

Assignment: Final Project, Stage 1 (Due 10/26/10)

10/27/10 Android 2 Videos: Lecture 17. Bonjour, NSStream, GameKit (March 2, 2010)

Lecture 18. Unit Testing; Fun with Objective-C; Localization (March 4, 2010) Assignment: Advanced Feature App or iPad Application (Due 11/02/10)

11/3/10 Windows Phone 7, Final Project Prep Videos: Lecture 19. OpenGL ES Basics (March 9, 2010)

Lecture 20. From Student to Startup: Lessons from a CS193P Alumnus (March 11, 2010) Assignment: Final Project, Stage 2 (Due 11/09/2010)

11/10/10 iPhone v. Android v. Windows Phone 7 group discussion Videos: Yelp Monocle (February 6, 2010)

Evernote (February 19, 2010)Bump (February 26, 2010)

Assignment: Final Project, Stage 3 (Due 11/16/2010)

11/17/10 Final Project Prep Videos: Publishing on the App Store (March 5, 2010)

LinkedIn: Important Life Lessons on CoreData & GameKit (March 12, 2010) Assignment: Final Project (Due 12/01/2010)

11/24/10 Thanksgiving – Continue Final Projects on your own

12/1/10 Demonstrate Final Projects

12/5/10 Class Offsite – Sunday (tentative)

SEC - 9/01/10

COMP 446 / ELEC 446 - Week 4 11

Submitting Assignments

Please delete your build directory before submitting. It makes a 2MB file closer to 100KB or less.

Programs with errors or warnings will be sent back without comments unless you explicitly let me know you are having issues you can not fix.

SEC - 9/15/10

COMP 446 / ELEC 446 - Week 4 12

Check Your Fundamentals

If you still feel lost: Come to TA sessions Re-watch iTunes U videos 2, 3, and 4

Try and use spring 2009 versions for a slightly different perspective

Take your time. Study the PDFs. Pause and rewind the video until things are more clear.

SEC - 9/15/10

COMP 446 / ELEC 446 - Week 4 13

Memory Management Basics

Object Creation + alloc and - init methods Objects take space, space allocated with alloc and initialized with

init. Object retention

The objects maintain a retention count. [object retain] increases that count by 1 [object release] decrease that count by 1 When count reaches 0, [object dealloc] automatically called.

Objects retained by other objects need to be released when finished

Either when explicitly finished or in the dealloc method Objects which might get released to 0 by others need to be retained

SEC - 9/15/10

COMP 446 / ELEC 446 - Week 4 14

Pointers vs. Objects

Objects exist in the heap and take up resources

Variable names, for example (NSString *) point at objects. Their value is a pointer to the real object.

Names can be set to nil (0) when they point to nothing

SEC - 9/15/10

COMP 446 / ELEC 446 - Week 4 15

Pointers vs. Objects

Copying objects, particularly NSString guarantees they won’t be changed from under you You may cast them as an NSString, but it might be an

NSMutableString

Multiple names can point to the same object (NSMutableString *)mstring1 = [NSMutableString setString:@”Hi”];

(NSString *)string2 = mstring1;

// string2 == mstring1; both point to same object

SEC - 9/15/10

COMP 446 / ELEC 446 - Week 4 16

Instance Variables and Properties Memory

Instance variables take up some space int, float, etc store the actual values (NSString *) iVar saves room for a pointer to an NSString

object The space needed by the actual object goes away when the

object is deallocated, not when the pointer goes away. Variables initialized to 0 or nil. This includes pointer objects.

Instance variables assigned to objects need to be released during object deallocation

OK to message nil objects, not OK to release deallocated objects

SEC - 9/15/10

COMP 446 / ELEC 446 - Week 4 17

NSString Setter

- (void)setName:(NSString *)newName {

if (name != newName) {

[name release]; //old name retain count

down 1

name = [newName retain];

// name’s retain count has been bumped

up by 1

}

SEC - 9/15/10

COMP 446 / ELEC 446 - Week 4 18

NSString Setter

- (void)setName:(NSString *)newName {

if (name != newName) {

[name release];

name = [newName copy];

// name has retain count of 1, we own it

}

SEC - 9/15/10

COMP 446 / ELEC 446 - Week 4 19

Autorelease

If you know you are finished with an object and you retained or own it, release it when finished. It will go away if you are the last reference.

If you no longer need the object yourself, but want to pass it to someone else, autorelease the object; let them be responsible for retaining it.

If you know you will be done with the object during this run loop but can’t tell where in your code you may finish with it, autorelease the object.

If you acquire an autoreleased object and believe you will need it on a different run-loop cycle, retain the object and later release it.

SEC - 9/15/10

COMP 446 / ELEC 446 - Week 4 20

Initial Retention Count

Objects received through [class alloc] or [class copy] come with a retention count of 1

By convention, all other objects are owned by others and likely come autoreleased They will be automatically destroyed on next wait

loop unless otherwise retained

SEC - 9/15/10

COMP 446 / ELEC 446 - Week 4 21

- (void) dealloc { }

First (optional step) is to run any logic cleanup code Second step is to release any retained objects.

[object release], not [object deallocate]. Do not release the deallocated object itself (no

[self release]) Final step is to call [super dealloc]

SEC - 9/15/10

COMP 446 / ELEC 446 - Week 4 22

Property Memory Management

Header options readonly – getter, no setter. Property can not be changed. readwrite (default) – setter and getter assign, retain and copy relate to how setter is coded

SEC - 9/15/10

- (void)setName: (NSString *)value{

if (value != name) {// [name release];name = value;

}} // Probably you would not want this

- (void)setName: (NSString *)value

{if (value != name) {

[name release];name = [value retain];

}} //Name points to other object

- (void)setName: (NSString *)value

{if (value != name) {

[name release];name = [value copy];

}} // Creates a copy which you own

assign retain copy

COMP 446 / ELEC 446 - Week 4 23

Last Week’s Assignment

The – (NSString *) name {…} method

Controller awakeFromNib method and setting up your poygonShape

Changes in IB relating to Outlets, Actions

Warning Levels Case sensitivity, iVar declarations, NSLog SDK Versions

SEC - 9/15/10

COMP 446 / ELEC 446 - Week 4 24

Week 5 Assignments

View CS193P Lecture 5 : Views and Drawing, Animations View CS193P Lecture 6 : View Controllers Basics, MVC Assignment: HelloPoly II [3] (Due 9/21/10) Note: On LogMeIn, Control Drag does not work as if you were local

Websites 101 HTML, Browsers, Client/Server / JavaScript, AJAX, ASP.Net iPhone (pseudo) Web Apps, Browser Capabilities

Future Feel free to get ahead of plan with videos and published assignments

Workload will get harder with each assignment. We will follow CS193P assignments up to and including Paparazzi 3

Start thinking about big project Really – start thinking about big project!

SEC - 9/15/10