Your SlideShare is downloading. ×
  • Like
Bootstrapping iPhone Development
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.


Now you can save presentations on your phone or tablet

Available for both IPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Bootstrapping iPhone Development


iPhone, the next generation mobile platform has revolutionized the way one uses phones as it's a combination of a phone, an iPod and an internet device. The iPhone is a richer platform for application …

iPhone, the next generation mobile platform has revolutionized the way one uses phones as it's a combination of a phone, an iPod and an internet device. The iPhone is a richer platform for application delivery due to an exponential growth and wide spread usage.

The critical factor, for a successful mobile application is the end user experience: application usability, reliability, and performance which the iPhone delivers in style. There are thousands of applications created by hundreds of developers for the iPhone. This kind of innovation helps you start developing the next generation of innovative mobile applications now.

Topics Covered
* Current State of iPhone Development
* Fast Track to Objective C
* Fast Track to XCode and Interface Builder
* Getting Productive using OR-Framework, Testing, Serialization

Munjal Budhabhatti is a senior solution developer at ThoughtWorks. He possesses over 10 years of experience in designing large-scale enterprise applications and has implemented innovative solutions for some of the largest microfinance, insurance and financial organizations. He loves writing well-designed enterprise applications using Agile processes. His article on "Test-Driven Development and Continuous Integration for Mobile Applications" was recently published in the Microsoft Architecture Journal.

Published in Technology , News & Politics
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads


Total Views
On SlideShare
From Embeds
Number of Embeds



Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

    No notes for slide


  • 1. Bootstrapping iPhone Development Munjal Budhabhatti Senior Consultant Sep/24/2009 San Antonio
  • 2. Agenda !!Current state of iPhone Development !!Fast track to Objective – C !!Fast track to XCode and Interface Builder !!Getting productive using OR-Framework, Testing, Serialization
  • 3. Current state of iPhone Development •! Requirements –! Intel based Mac with OSX 10.5 –! iPhone SDK (Sign-up for iPhone Developer Program $99 for a year) –! Do NOT need iPhone or iPod Touch (Work on iPhone Simulator) •! Developer Resources
  • 4. Fast track to Objective – C •! Object oriented programming language to write Applications for iPhone and Mac OS •! Powerful set of extensions to the standard ANSI C language –! Object oriented –! Dynamic (Adds Smalltalk-style or Ruby-style messaging) •! You manage your memory – Probably a good thing in mobile devices
  • 5. Objective – C Syntax •! Objective – C is a strict superset thin layer on top of ANSI C •! Compile any ANSI C program with Objective – C compiler •! Object syntax derived from Smalltalk •! Non object oriented syntax identical to C •! A bit clumsy syntax. Can get lost in the woods. Do NOT let the syntax defeat you.
  • 6. Coding in Objective – C •! Classes are developed using a header and an implementation. •! Names and types of instance variables and method signature in header file. Implement methods in implementation file Interface Implementation @interface classname : superclassname { @implementation classname //instance variables + classMethod1 { } } +classMethod1; + (returnType) classMethod2 { +(returnType) classMethod2; } -instanceMethod1; - instanceMethod1 { -(returnType) instanceMethod2; } @end - (returnType) instanceMethod2 { }
  • 7. Messages (Methods) in Objective – C •! Java and C# implements Simula-style programming model: a method is bound to section of code in a compiler •! Objective – C is based on sending messages to object instances. Message is simply a name, resolved at runtime by the receiving object. •! fullName = [firstName stringByAppendingString: lastName] •! No type-checking. If the object cannot respond to a message it simply ignores it. No NULL checking!! Yay!!
  • 8. Static and Dynamic Typing Objective – C •! Static typing using NSObject – the mother of almost all objects. You can have objects that don’t derive from NSObject. •! Dynamic typing using id –! Sending messages to Nil is OK –! Dynamic objection creation: objc_getClass, class_createInstance, class_getInstanceMethod, class_getInstanceVariable –! TypeIntrospection : isMemberOfClass & isKindOfClass
  • 9. Invocation and Memory Management in Objective – C •! Memory management possible using Garbage collector for Mac OS •! You manage your memory for iPhone OS •! LeanManager *ronCampbell = [[LeanManager alloc] init];
  • 10. Protocols in Objective – C •! Supports multiple-inheritance of specification •! Similar to Interface in C# and Java. However, the methods could be optional. •! Used to declare methods that could be implemented by any class •! Used to declare interface to an object while concealing its class •! Used to capture similarities among classes that are not in hierarchy
  • 11. Protocol Example in Objective – C @protocol Serialization @interface AccountImage : Image <Serialization> - (void) serialize; - (void) serialize; - (void) deserialize; - (void) deserialize; @end @end
  • 12. Forwarding in Objective – C •! Dynamic nature of Objective C allows forwarding of messages •! If an object doesn’t respond to a message, it can forward to one that probably could. •! Similar to method_missing in Ruby •! ages = [persons age]
  • 13. Category in Objective – C •! A category allows you to add methods to an existing class – even for ones that you don’t own or have the source code •! Allows to extend the functionality without subclassing •! Split the implementation of your class between several files •! Caveat: Cannot create new instance variable in a class
  • 14. Fast track to Interface Builder •! App for iPhone devs to create GUI •! Typical MVC pattern. Write models and controllers in Xcode. Build interface in Interface Builder •! One could build interface using code. However, I would advise to bear the pain once and learn using Interface Builder with Xcode. •! Nib file and the magic
  • 15. Fast Track to OR-framework such as Active Record •! Beautify your models –! Will you make raw SQL calls ? •! Start using ObjectPersistentFramework
  • 16. Fast track to Testing •! Test using GoogleToolbox •! Mock using OCMock •! Serialization using JSON framework for iPhone
  • 17. iPhone development fundamentals •! Cocoa Touch – Framework to develop touchscreen applications: UI elements, event dispatching, application lifecycle •! Media – Graphics, animations, sound, video •! Core Services – Collections, Strings, Location, SQLLite, Networking •! Core OS Layer – Standard IO/, Power Management
  • 18. main() method •! Java/C# developers look for “main()” method •! NSApplication provides the central framwork for app execution •! Every app creates one instance of NSApplication in main() •! After NSApplication creation, load the Nib file and start event loop •! Nib file loads the UI •! applicationDidFinishLauching() method called when app is launched
  • 19. View Controllers •! Model View Controller Pattern •! Each view in an iPhone app is managed by UIViewController •! Mother of all view classes •! Importance of IBAction and IBOutlet •! IBAction: editButtonClicked() •! IBOutlet: UILabel
  • 20. Table View Controller •! Define and populate NSMutableArray in initWithCoder •! Implement numberOfRowsInSection protocol for tabelView •! Implement cellForRowAtIndexPath •! Improve performance by reusing cells
  • 21. Navigation Controller •! Mail app is the best way to understand navigation controller •! Navigation controller maintains stack of view controllers •! Each controller represents one node in hierarchy •! Typical push and pop to manage controllers •! [self.navigationController pushViewController: self.ctr animate:YES] •! [self.navigationController popViewControllerAnimate: YES];
  • 22. File I/O •! Your appliction is Sandboxed. Cannot access data from other apps •! Documents directory •! Tmp directory