Upload
others
View
3
Download
0
Embed Size (px)
Citation preview
CodeFab LLCiPhone Development & Training
Architecting a complex iPhone application
Alex Cone - Alpha Geek - CodeFab LLC
1Wednesday, October 7, 2009
CodeFab LLCiPhone Development & Training
So What’s The Problem?
• No Apple examples of full featured applications
• Books cover implementation of features, but not architecture
• Developers tend to start with examples and evolve - leading to poor architecture
2Wednesday, October 7, 2009
CodeFab LLCiPhone Development & Training
Application Tasks
• First Launch• News Preferences
• Location Acquisition
• Story Load, Caching
3Wednesday, October 7, 2009
CodeFab LLCiPhone Development & Training
Application Tasks
• Relaunch Update
• Recheck Location
• Check Data Freshness
• Update Data
4Wednesday, October 7, 2009
CodeFab LLCiPhone Development & Training
Application Tasks
• Handle User Activity
• Story Reading
• Queries
• Sharing...
• Advertising
• Image Caching
• Saving State...
5Wednesday, October 7, 2009
CodeFab LLCiPhone Development & Training
Design Challenge
• Application Design
• Managing Long Running Tasks
• Managing Concurrency
• Managing Variable Connectivity
• Managing Data
• Managing State
• Managing Complexity
6Wednesday, October 7, 2009
CodeFab LLCiPhone Development & Training
Advanced Technology
• Singletons
• Notifications
• Threads
• NSOperation/NSOperationQueue
7Wednesday, October 7, 2009
CodeFab LLCiPhone Development & Training
Singletons
• Decoupled Objects
• Data Managers
• Cache Managers
• State Managers
• Specialty Controllers (e.g. LaunchController)
• NSApplication, NSUserDefaults, etc...
8Wednesday, October 7, 2009
CodeFab LLCiPhone Development & Training
Singletons
UIImage *userPic = [[ImageCache shared] cachedImageForKey:[user name]];
...
+ (id)shared { static ImageCache *shared = nil; if(!shared){ shared = [[ImageCache allocWithZone:NULL] init]; } return shared;}
9Wednesday, October 7, 2009
CodeFab LLCiPhone Development & Training
Notifications
• More Object Decoupling
• Status Notification
• State Change
• Pub/Sub Events
• NSNotificationCenter
10Wednesday, October 7, 2009
CodeFab LLCiPhone Development & Training
Notifications
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateHUD:) name:@”TweetStatusNotification” object:nil];
...
- (void) updateHUD:(NSNotification *)notification { if (nil != self.view.window) { NSString *msg = [[notification userInfo] valueForKey:@”Message”]; [[HUDManager shared] showMessage:msg];}
11Wednesday, October 7, 2009
CodeFab LLCiPhone Development & Training
Threads
• UIKit & Foundation Support
• performAfterDelay
• Background execution with delegate callback (NSHTTPConnection, etc)
• NSThreads, NSOperationQueues
12Wednesday, October 7, 2009
CodeFab LLCiPhone Development & Training
Process Challenge
• Application Development
• Managing Development Cycles
• Managing Teams
• Managing Releases
• Testing and QA
• Code Reuse
13Wednesday, October 7, 2009
CodeFab LLCiPhone Development & Training
Advanced Process
• Hyper-Agile Methodology
• Daily Iterations
• Partial Pair Programming
• Monthly Releases
14Wednesday, October 7, 2009
CodeFab LLCiPhone Development & Training
Advanced Process
• Code Reuse Strategies
• Static Libraries
• Overlapping Projects
SharedCode
Project 2Project1
15Wednesday, October 7, 2009
Q&A
CodeFab LLCiPhone Development & Training
Architecting Complex iPhone Applications
Alex ConeCodeFab LLC
16Wednesday, October 7, 2009