Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Objective-C For Web Developers
Search
Addam Hardy
August 24, 2012
Programming
790
6
Share
Objective-C For Web Developers
Talk given at TechFest Northwest Arkansas 2012
Addam Hardy
August 24, 2012
More Decks by Addam Hardy
See All by Addam Hardy
Product Carousel Randomization & Optimization
addamh
0
31
A/B Testing
addamh
0
36
Kanban & Lean Manufacturing
addamh
0
92
What is caching? And why does it hate me?
addamh
0
32
Building Microservices on AWS with the Serverless Framework
addamh
0
120
Apache Spark & MLlib
addamh
0
120
Bayesian Sentiment Analysis with Ruby
addamh
0
160
Decision Trees, Data Science, and Machine Learning: Using Entropy to Discover Path to Purchase
addamh
1
220
Intro to Rails
addamh
0
140
Other Decks in Programming
See All in Programming
脅威をエンジニアリングの糧にして――現場編 / Turning Threats into Engineering Fuel — Field Edition
nrslib
0
190
Lemonade + Foundry Toolkit でお手軽アプリ開発
seosoft
1
160
Agentic UI beyond Chats Architecture Patterns & Open Standards @ngMunich 05/2026
manfredsteyer
PRO
0
150
ECR拡張スキャンでSBOMを収集して サプライチェーン攻撃の影響調査を 爆速で終わらせてみた
akihisaikeda
2
200
OCRを使ってゲームのアイテムをデータ化する
kishikawakatsumi
0
120
Technical Debt: Understanding it Rightly, Engaging it Rightly #LaravelLiveJP
shogogg
0
150
横断組織出身のQAEがインプロセスQAEでつまずいたこと・活かせたこと
ty89
0
360
開発とはなにか、Essenceカーネルで見えるもの
ukin0k0
0
210
生成AI時代にこそ効くGo | Why Go Works in the Age of Generative AI
mom0tomo
7
2.6k
Transactional Change Stream Processing With Debezium and Apache Flink
gunnarmorling
1
130
プラグインで拡張される Context をtype-safe にする難しさと設計判断
kazupon
2
310
oxlintはeslint/typescript-eslintを置き換えられるのか
shomafujita
2
240
Featured
See All Featured
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2k
So, you think you're a good person
axbom
PRO
2
2k
GitHub's CSS Performance
jonrohan
1033
470k
Building an army of robots
kneath
306
46k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
199
73k
Visualization
eitanlees
151
17k
How GitHub (no longer) Works
holman
316
150k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.2k
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
1
100
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.2k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2k
Transcript
For Objective-C Web Developers Addam Hardy
@addamh this guy Ruby on Rails Javascript Developer iOS
None
web developer? it’s time to evolve
tablet sales to surpass desktop sales by 2015
demand supply
demand supply profit
None
the run down
strict superset of C Objective-C
strict superset of C compiled language Objective-C
strict superset of C compiled language object-oriented Objective-C
strict superset of C compiled language object-oriented dynamic Objective-C
strict superset of C compiled language object-oriented dynamic strictly typed
Objective-C
strict superset of C compiled language object-oriented dynamic strictly typed
smalltalk style messaging Objective-C
strict superset of C compiled language object-oriented dynamic strictly typed
smalltalk style messaging very verbose Objective-C
difficulties for web developers
C bummers
C compiling! so much time! bummers
C compiling! so much time! the dynamic-ness. sort of. bummers
C compiling! so much time! the dynamic-ness. sort of. asynchronous/threading
bummers
C compiling! so much time! the dynamic-ness. sort of. asynchronous/threading
memory management bummers
C compiling! so much time! the dynamic-ness. sort of. asynchronous/threading
memory management bummers
C compiling! so much time! the dynamic-ness. sort of. asynchronous/threading
memory management static typing bummers
C compiling! so much time! the dynamic-ness. sort of. asynchronous/threading
memory management static typing errors bummers
xcode
xcode
xcode
xcode
xcode
xcode
xcode
xcode
typing
typing Ruby PHP Objective-C $var = 21; $variable = “This
is a string”; var = 21 variable = “This is a string” (int) var = 21; NSString *variable = @“This is a string”;
typing C Primitives Common Classes char short long unsigned char
unsigned int int float double bool NSString NSNumber NSArray NSDictionary NSMutableArray NSMutableDictionary UIView UIButton id and 20,000 others..
header files implementation files wat?
headers / implementation class.h The public API for the class
@interface Student { NSNumber *age; NSString *name; } @end
headers / implementation class.h class.m The public API for the
class The instructions for the class @interface Student { NSNumber *age; NSString *name; } @end @implementation Student - (NSString *) name { } @end
creating classes
classes Ruby PHP class HelloWorld { // instance variables go
here // methods go here public function sayHI() { print("Hello World!”); } } class HelloWorld // instance variables go here // methods go here def sayHI puts "Hello World!” end end
classes Objective-C @interface HelloWorld { NSString *statement = @”This is
a string” } -(void) sayHI; @end
classes Ruby PHP class cat extends animal { public function
be_cute() { print("I am teh cute”); } } class cat < animal def be_cute puts "I am teh cute” end end
classes Objective-C @interface Cat : Animal <CuteMultipler> { } -(void)
beCute; @end
properties
properties @property (nonatomic, retain) NSString *title; @property (nonatomic, assign) int
number;
properties @synthesize title; @synthesize number; [object setTitle:@”This is my title”];
NSLog(@”%@”, [object title]);
object instantiation
object instantiation Ruby PHP include_once('HelloWorld.class.php'); $hw = new HelloWorld; $hw->sayHI;
require ‘HelloWorld’ hw = HelloWorld.new hw.sayHI
Objective-C #import <Foundation/Foundation.h> @interface HelloWorld : NSObject { } -
(void)sayHI; @end object instantiation header
Objective-C #import “HelloWorld.h” @implementation HelloWorld - (void)sayHI { NSLog(@”Hi.”); }
@end object instantiation header
Objective-C #import <Foundation/Foundation.h> #import "HelloWorld.h" int main (int argc, const
char * argv[]) { HelloWorld *hw = [[HelloWorld alloc] init]; [hw printHelloDate]; return 0; } object instantiation main.m
methods /selectors
methods / selectors Ruby PHP function buyItem(item) { $cart =
new ShoppingCart; $cart->purchase(item); } def buyItem(item) cart = ShoppingCart.new cart.purchase(item) end
Objective-C - (void)buyItem:(ItemObject*)item { ShoppingCart *cart = [[ShoppingCart alloc] init];
[cart purchase:item]; } methods / selectors
def addObserver(key_path, options, context) end methods / selectors
def addObserver(key_path, options, context) end methods / selectors addObserver(key_path, options,
context)
-(void) addObserverForKeyPath:(NSIndexPath*)indexPath WithOptions:(NSDictionary*)options AndContext:(void*) { } methods / selectors
-(void) addObserverForKeyPath:(NSIndexPath*)indexPath WithOptions:(NSDictionary*)options AndContext:(void*) { } methods / selectors [object
addObserverForKeyPath:indexPath WithOptions:options AndContext:nil]
common pitfalls
common pitfalls NSString *this = @”kitty”; NSString *that = @”kitty”;
if(this == that){ NSLog(@”This will not happen”); } if([this isEqualToString:that]){ NSLog(@”This will happen!”); } NO YES
common pitfalls @synthesize this; @synthesize that; @synthesize those; @synthesize this,
that, those; NO YES
common pitfalls @interface MyNewClass @end @interface MyNewClass : NSObject @end
NO YES
common pitfalls start writing implementation right away always declare methods
in header first then implement NO YES
just do it!
thanks!