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
810
6
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
36
A/B Testing
addamh
0
40
Kanban & Lean Manufacturing
addamh
0
96
What is caching? And why does it hate me?
addamh
0
38
Building Microservices on AWS with the Serverless Framework
addamh
0
130
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
230
Intro to Rails
addamh
0
150
Other Decks in Programming
See All in Programming
Flow は今どうなっているか
mizdra
PRO
0
210
AWS DevOps AgentのAzure接続機能を検証して見えた活用法/Use Cases Verified for the AWS DevOps Agent's Azure Connectivity Feature
masakiokuda
1
230
AI時代に設計が 最大の生産性レバーになる 意図駆動開発とデータを消さない設計|Don't Delete Your Data or Your Intent — Design as the Deepest Lever in the AI Era
tomohisa
1
840
生成AIで帳票OCRが「簡単に」作れる時代になった?
kon_shou
0
820
5分で問診!Composer セキュリティ健康診断
codmoninc
0
970
20260722_microCMSで考える、AI時代のコンテンツ運用設計
yosh1
0
400
Go言語とトイモデルで学ぶTransformerの気持ち / fukuokago23-transformer
monochromegane
0
170
【やさしく解説 設計編・中級 #6】良いアーキテクチャとは ~ 一本の登り道の、行き先 ~
panda728
PRO
0
210
ITヒヤリハットを整理してみた ~ライフサイクルと原因から考える再発防止策~
koukimiura
1
140
夏だ!祭りだ!祭りとはドメインモデリングでは?
ryugen04
0
250
PHP に部分適用が来るぞ!……ところで何それ?おいしいの? #phpcon / phpcon-2026
shogogg
0
640
Terraform標準の組織で AWS CDKをどう使うか
mu7889yoon
1
510
Featured
See All Featured
The SEO Collaboration Effect
kristinabergwall1
1
520
It's Worth the Effort
3n
188
29k
Art, The Web, and Tiny UX
lynnandtonic
304
22k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
68
56k
Optimising Largest Contentful Paint
csswizardry
37
3.9k
Claude Code のすすめ
schroneko
67
230k
Balancing Empowerment & Direction
lara
6
1.2k
Visualization
eitanlees
152
17k
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
430
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
VelocityConf: Rendering Performance Case Studies
addyosmani
332
25k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.1k
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!