Bootstrapping iPhone Development
Upcoming SlideShare
Loading in...5
×
 

Bootstrapping iPhone Development

on

  • 2,983 views

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.

Statistics

Views

Total Views
2,983
Views on SlideShare
2,961
Embed Views
22

Actions

Likes
2
Downloads
54
Comments
0

2 Embeds 22

http://www.slideshare.net 21
http://admin 1

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Bootstrapping iPhone Development Bootstrapping iPhone Development Presentation Transcript

  • Bootstrapping iPhone Development Munjal Budhabhatti Senior Consultant Sep/24/2009 San Antonio
  • 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
  • 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 http://developer.apple.com/iphone http://devforums.apple.com http://cs193p.stanford.edu
  • 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
  • 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.
  • 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 { }
  • 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!!
  • 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
  • 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];
  • 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
  • Protocol Example in Objective – C @protocol Serialization @interface AccountImage : Image <Serialization> - (void) serialize; - (void) serialize; - (void) deserialize; - (void) deserialize; @end @end
  • 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]
  • 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
  • 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
  • Fast Track to OR-framework such as Active Record •! Beautify your models –! Will you make raw SQL calls ? •! Start using ObjectPersistentFramework
  • Fast track to Testing •! Test using GoogleToolbox •! Mock using OCMock •! Serialization using JSON framework for iPhone
  • 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
  • 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
  • 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
  • Table View Controller •! Define and populate NSMutableArray in initWithCoder •! Implement numberOfRowsInSection protocol for tabelView •! Implement cellForRowAtIndexPath •! Improve performance by reusing cells
  • 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];
  • File I/O •! Your appliction is Sandboxed. Cannot access data from other apps •! Documents directory •! Tmp directory