240 likes | 366 Views
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 cutler@rice.edu 9/15/10. Today’s Agenda. Events of the week
E N D
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 cutler@rice.edu 9/15/10
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 COMP 446 / ELEC 446 - Week 4
Events of the Week • Apple Backs Off Restriction on App Store Development Tools • iOS 4.1 now available on iTunes • iPad Cannibalizing Whole Notebook PC Industry • Nokia Turns to Microsoft for New Chief Executive • Meet Google Instant: Results as queries are typed • 'YouTube Instant' creator finds instant fame • Microsoft legal punch may change botnet battles forever COMP 446 / ELEC 446 - Week 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 COMP 446 / ELEC 446 - Week 4
Current Roster • Julia Botev • COMP, SR, McMurtryJulia.K.Botev@rice.edu • Eric Cheng • COMP, GR eric.cheng@rice.edu • Jesus Cortez • COMP, JR, Jones JesusCortez@rice.edu • Graham De Wit • ELEC, SR, Wiessgraham.dewit@rice.edu • Ashley Herron • ELEC, SR, Martel Ashley.N.Herron@rice.edu • Tara Hong • ELEC, SR, Will Rice Seoyeon.Hong@rice.edu • Vic Hu • ELEC, SR, Wiessmrwho@rice.edu • Marcos Hung • BIOE, GR Marcos.G.Hung@rice.edu COMP 446 / ELEC 446 - Week 2
Current Roster (2) • Jin Kim • COMP, GR Kyujin.Kim@rice.edu • Kevin Lin • COMP, SO, McMurtryKevin.S.Lin@rice.edu • Robyn Moscowitz • COMP, JR, McMurtryRobyn.A.Moscowitz@rice.edu • Norman Pai • ELEC, SR, HanszenNorman.L.Pai@rice.edu • Josh Rykowski • COMP, GR Joshua.Rykowski@rice.edu • Ivan Van • COMP, SR, Will Rice, i.van@rice.edu • Jeff Yeh • ELEC, SR, Hanszenjeff.yeh@rice.edu • Aron Yu • ELEC, SR, HanszenAron.Yu@rice.edu COMP 446 / ELEC 446 - Week 2
Current Roster (3) • Michael Lo • ELEC, GR mlo@rice.edu • Elliot Ng • ELEC, GR elliottng@rice.edu • Rick Manning • COMP, SR, Jones rick.manning@rice.edu • Henry Zhang • ELEC, SR, Jones qz1@rice.edu • Jason Xu • ELEC, SR, Brown jax1@rice.edu • Catherine Elder • ELEC, SR, Hanszencje1@rice.edu COMP 446 / ELEC 446 - Week 2
Current Roster (4) • Sid Byrd • Staff sidb@rice.edu • Xiang ‘Jash’ Guo • ELEC, GR xg1@rice.edu • Wenyang Wu • CS, GR ww7@rice.edu • ZheRen • CS, GR zr2@rice.edu COMP 446 / ELEC 446 - Week 2
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) COMP 446 / ELEC 446 - Week 2
COMP 446 Syllabus • 10/13/10iPad 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) COMP 446 / ELEC 446 - Week 2
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. COMP 446 / ELEC 446 - Week 4
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. COMP 446 / ELEC 446 - Week 4
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 COMP 446 / ELEC 446 - Week 4
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 COMP 446 / ELEC 446 - Week 4
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 = [NSMutableStringsetString:@”Hi”];(NSString *)string2 = mstring1; // string2 == mstring1; both point to same object COMP 446 / ELEC 446 - Week 4
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 COMP 446 / ELEC 446 - Week 4
NSString Setter - (void)setName:(NSString *)newName{ if (name != newName) { [name release]; //old name retain count down 1 name = [newNameretain]; // name’s retain count has been bumped up by 1} COMP 446 / ELEC 446 - Week 4
NSString Setter - (void)setName:(NSString *)newName { if (name != newName) { [name release]; name = [newNamecopy]; // name has retain count of 1, we own it} COMP 446 / ELEC 446 - Week 4
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. COMP 446 / ELEC 446 - Week 4
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 COMP 446 / ELEC 446 - Week 4
- (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] COMP 446 / ELEC 446 - Week 4
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 assign retain copy • (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 COMP 446 / ELEC 446 - Week 4
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 COMP 446 / ELEC 446 - Week 4
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! COMP 446 / ELEC 446 - Week 4