architecting a complex - jaoo.dkjaoo.dk/dl/jaoo-aarhus-2009/slides/alexcone_iphoneapplication... ·...

16
CodeFab LLC iPhone Development & Training Architecting a complex iPhone application Alex Cone - Alpha Geek - CodeFab LLC 1 Wednesday, October 7, 2009

Upload: others

Post on 25-Sep-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Architecting a complex - jaoo.dkjaoo.dk/dl/jaoo-aarhus-2009/slides/AlexCone_IPhoneApplication... · iPhone Development & Training Process Challenge • Application Development •

CodeFab LLCiPhone Development & Training

Architecting a complex iPhone application

Alex Cone - Alpha Geek - CodeFab LLC

1Wednesday, October 7, 2009

Page 2: Architecting a complex - jaoo.dkjaoo.dk/dl/jaoo-aarhus-2009/slides/AlexCone_IPhoneApplication... · iPhone Development & Training Process Challenge • Application Development •

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

Page 3: Architecting a complex - jaoo.dkjaoo.dk/dl/jaoo-aarhus-2009/slides/AlexCone_IPhoneApplication... · iPhone Development & Training Process Challenge • Application Development •

CodeFab LLCiPhone Development & Training

Application Tasks

• First Launch• News Preferences

• Location Acquisition

• Story Load, Caching

3Wednesday, October 7, 2009

Page 4: Architecting a complex - jaoo.dkjaoo.dk/dl/jaoo-aarhus-2009/slides/AlexCone_IPhoneApplication... · iPhone Development & Training Process Challenge • Application Development •

CodeFab LLCiPhone Development & Training

Application Tasks

• Relaunch Update

• Recheck Location

• Check Data Freshness

• Update Data

4Wednesday, October 7, 2009

Page 5: Architecting a complex - jaoo.dkjaoo.dk/dl/jaoo-aarhus-2009/slides/AlexCone_IPhoneApplication... · iPhone Development & Training Process Challenge • Application Development •

CodeFab LLCiPhone Development & Training

Application Tasks

• Handle User Activity

• Story Reading

• Queries

• Sharing...

• Advertising

• Image Caching

• Saving State...

5Wednesday, October 7, 2009

Page 6: Architecting a complex - jaoo.dkjaoo.dk/dl/jaoo-aarhus-2009/slides/AlexCone_IPhoneApplication... · iPhone Development & Training Process Challenge • Application Development •

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

Page 7: Architecting a complex - jaoo.dkjaoo.dk/dl/jaoo-aarhus-2009/slides/AlexCone_IPhoneApplication... · iPhone Development & Training Process Challenge • Application Development •

CodeFab LLCiPhone Development & Training

Advanced Technology

• Singletons

• Notifications

• Threads

• NSOperation/NSOperationQueue

7Wednesday, October 7, 2009

Page 8: Architecting a complex - jaoo.dkjaoo.dk/dl/jaoo-aarhus-2009/slides/AlexCone_IPhoneApplication... · iPhone Development & Training Process Challenge • Application Development •

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

Page 9: Architecting a complex - jaoo.dkjaoo.dk/dl/jaoo-aarhus-2009/slides/AlexCone_IPhoneApplication... · iPhone Development & Training Process Challenge • Application Development •

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

Page 10: Architecting a complex - jaoo.dkjaoo.dk/dl/jaoo-aarhus-2009/slides/AlexCone_IPhoneApplication... · iPhone Development & Training Process Challenge • Application Development •

CodeFab LLCiPhone Development & Training

Notifications

• More Object Decoupling

• Status Notification

• State Change

• Pub/Sub Events

• NSNotificationCenter

10Wednesday, October 7, 2009

Page 11: Architecting a complex - jaoo.dkjaoo.dk/dl/jaoo-aarhus-2009/slides/AlexCone_IPhoneApplication... · iPhone Development & Training Process Challenge • Application Development •

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

Page 12: Architecting a complex - jaoo.dkjaoo.dk/dl/jaoo-aarhus-2009/slides/AlexCone_IPhoneApplication... · iPhone Development & Training Process Challenge • Application Development •

CodeFab LLCiPhone Development & Training

Threads

• UIKit & Foundation Support

• performAfterDelay

• Background execution with delegate callback (NSHTTPConnection, etc)

• NSThreads, NSOperationQueues

12Wednesday, October 7, 2009

Page 13: Architecting a complex - jaoo.dkjaoo.dk/dl/jaoo-aarhus-2009/slides/AlexCone_IPhoneApplication... · iPhone Development & Training Process Challenge • Application Development •

CodeFab LLCiPhone Development & Training

Process Challenge

• Application Development

• Managing Development Cycles

• Managing Teams

• Managing Releases

• Testing and QA

• Code Reuse

13Wednesday, October 7, 2009

Page 14: Architecting a complex - jaoo.dkjaoo.dk/dl/jaoo-aarhus-2009/slides/AlexCone_IPhoneApplication... · iPhone Development & Training Process Challenge • Application Development •

CodeFab LLCiPhone Development & Training

Advanced Process

• Hyper-Agile Methodology

• Daily Iterations

• Partial Pair Programming

• Monthly Releases

14Wednesday, October 7, 2009

Page 15: Architecting a complex - jaoo.dkjaoo.dk/dl/jaoo-aarhus-2009/slides/AlexCone_IPhoneApplication... · iPhone Development & Training Process Challenge • Application Development •

CodeFab LLCiPhone Development & Training

Advanced Process

• Code Reuse Strategies

• Static Libraries

• Overlapping Projects

SharedCode

Project 2Project1

15Wednesday, October 7, 2009

Page 16: Architecting a complex - jaoo.dkjaoo.dk/dl/jaoo-aarhus-2009/slides/AlexCone_IPhoneApplication... · iPhone Development & Training Process Challenge • Application Development •

Q&A

CodeFab LLCiPhone Development & Training

Architecting Complex iPhone Applications

Alex ConeCodeFab LLC

[email protected]

16Wednesday, October 7, 2009