SlideShare a Scribd company logo
1 of 38
Download to read offline
MY ADVENTURES IN
   OBJECTIVE-C
@abdels / @thesupertimes
Objective-C sucks!
Its just as crappy as Java!
I’m waiting for MacRuby!
OH NO!!
still no iOS support, Boll@@ks!
Objective-C Haters!
Solutions
PhoneGap
Titanium Appcelerator
But really, why all the hating?
That’s pride f**king with you. F**k pride.
Pride only hurts. It never helps. You fight
            through that sh*t!
So, here's what I Learnt,
SMALL TALK GUY (ALAN KAY)
Objective-C, is reflective, OO,
        Smalltalk-ish!
Sound a lot like Ruby
Unlike Ruby,
Objective-C is a strict superset of C
Object Message passing :
Obj-C
[world say:@"hello"];


Ruby
world.say("hello")
Object Message passing :

Obj-C
[world say:@"hello"];

[world performSelector:@selector(say:) withObject:@"hello"]

objc_sendMsg(id object, SEL selector)
Object Message passing :

Ruby
world.send(:say, "hello")
Non-strict typing (Duck Typing?)
Obj-C
id world = [[World alloc] init];
[world peace];


Here 'id' is a pointer to any object.
Non-strict typing (Duck Typing?)
Obj-C
World *world = [[World alloc] init];
[world peace];

This ensures method compiler checks!
Object declaration
Obj-C
MyClass * myObject = [[MyClass alloc] init];


Ruby (pseudo code)
class Object
	

 def self.new(*args)
	

 	

 self.alloc.initialize(*args)
	

 end
end
Interface/Implementation (the C thing)
world.h (header file)
#import <UIKit/UIKit.h>

@interface World : NSObject {
  NSString *foo;
}

@property (copy, retain) NSString *foo;

-(NSString *) say:(NSString *)something;
@end
Interface/Implementation (the C thing)
world.m (implementation file)
#import "world.h"

@implementation World
@synthesize foo;

-(NSString *) say:(NSString *)something{}

- (void)dealloc {
  [foo release];
  [super dealloc];
}
@end
Properties aka attr_accessor
@interface World : NSObject {
 NSString *foo;
 ...
 @property (copy, retain) NSString *foo;
 ...
@end

@implementation World
@synthesize foo;
...
@end
Properties aka attr_accessor
@synthesize: creates dynamic setters and getters and
performs the necessary memory allocation.

-(void)setFoo:(Foo *)s {
	

 if(foo != s) {
	

 	

 [foo release];
	

 	

 foo = [s retain];
	

 }
}

-(Foo *)foo { return foo; }
Interfaces with Protocols
@protocol Shopper
- (void)recession;
- (void)boom;
@end

@interface World : NSObject <Shopper>
@end
Monkey Patching with Categories
UIImage+RoundedCorner.h
@interface UIImage (RoundedCorner)
- (UIImage *)roundedCornerImage;
@end

UIImage+RoundedCorner.m
@implementation UIImage
(RoundedCorner)
- (UIImage *)roundedCornerImage {
  //Make rounded corners
}
@end
We Have Blocks!
NSArray *films = [NSArray arrayWithObjects:@"Reservoir
Dogs", @"Pulp Fiction", @"Kill Bill", nil];

[films enumerateObjectsUsingBlock:^(id object, NSUInteger
index, BOOL *stop) {
    NSLog(@"%@ film at index %d", object, index);
}];
We Have Blocks!
int (^negative)(int) = ^(int number) {
   return number * -1;
};

int result = negative(2);
Basics over
You panicked, but don’t
iOS is a powerful platform that
        controls phones
Your brain & eyes hurting is a small
 price to pay for the privelage :P
REFERENCES
  HTTP://EN.WIKIPEDIA.ORG/WIKI/OBJECTIVE-C


  HTTP://EN.WIKIPEDIA.ORG/WIKI/MACRUBY


  HTTP://OFPS.OREILLY.COM/TITLES/9781449380373/INDEX.HTML


  HTTP://BLOG.PHUSION.NL/2010/03/24/OBJECTIVE-C-FOR-RUBY-DEVELOPERS-
  UN-NOT-SO-PETIT-INTERLUDE-1/


  HTTP://GOSHAKKK.NAME/BLOG/2011/08/19/OBJECTIVE-C-RUBYISTS-INSIGHT/


  HTTP://GOOGLE-STYLEGUIDE.GOOGLECODE.COM/SVN/TRUNK/
  OBJCGUIDE.XML
@abdels / @thesupertimes

More Related Content

What's hot

Keeping it small: Getting to know the Slim micro framework
Keeping it small: Getting to know the Slim micro frameworkKeeping it small: Getting to know the Slim micro framework
Keeping it small: Getting to know the Slim micro framework
Jeremy Kendall
 
UPenn on Rails pt 2
UPenn on Rails pt 2UPenn on Rails pt 2
UPenn on Rails pt 2
Mat Schaffer
 
Trading with opensource tools, two years later
Trading with opensource tools, two years laterTrading with opensource tools, two years later
Trading with opensource tools, two years later
clkao
 
Converting your JS library to a jQuery plugin
Converting your JS library to a jQuery pluginConverting your JS library to a jQuery plugin
Converting your JS library to a jQuery plugin
thehoagie
 
Your Library Sucks, and why you should use it.
Your Library Sucks, and why you should use it.Your Library Sucks, and why you should use it.
Your Library Sucks, and why you should use it.
Peter Higgins
 
"Lego Programming" with Lorzy
"Lego Programming" with Lorzy"Lego Programming" with Lorzy
"Lego Programming" with Lorzy
clkao
 

What's hot (19)

구름 이야기(Feat. gcp) - 구글클라우드(GCP) 활용 사례
구름 이야기(Feat. gcp) - 구글클라우드(GCP) 활용 사례구름 이야기(Feat. gcp) - 구글클라우드(GCP) 활용 사례
구름 이야기(Feat. gcp) - 구글클라우드(GCP) 활용 사례
 
Make Your Own Perl with Moops
Make Your Own Perl with MoopsMake Your Own Perl with Moops
Make Your Own Perl with Moops
 
Introduction to Ruby, Rails, and Ruby on Rails
Introduction to Ruby, Rails, and Ruby on RailsIntroduction to Ruby, Rails, and Ruby on Rails
Introduction to Ruby, Rails, and Ruby on Rails
 
EuroPython 2017 - Bonono - Simple ETL in python 3.5+
EuroPython 2017 - Bonono - Simple ETL in python 3.5+EuroPython 2017 - Bonono - Simple ETL in python 3.5+
EuroPython 2017 - Bonono - Simple ETL in python 3.5+
 
Non-Relational Databases
Non-Relational DatabasesNon-Relational Databases
Non-Relational Databases
 
Node.js
Node.jsNode.js
Node.js
 
Mojo as a_client
Mojo as a_clientMojo as a_client
Mojo as a_client
 
Interceptors: Into the Core of Pedestal
Interceptors: Into the Core of PedestalInterceptors: Into the Core of Pedestal
Interceptors: Into the Core of Pedestal
 
Keeping it small: Getting to know the Slim micro framework
Keeping it small: Getting to know the Slim micro frameworkKeeping it small: Getting to know the Slim micro framework
Keeping it small: Getting to know the Slim micro framework
 
iSoligorsk #3 2013
iSoligorsk #3 2013iSoligorsk #3 2013
iSoligorsk #3 2013
 
Voyage by example
Voyage by exampleVoyage by example
Voyage by example
 
UPenn on Rails pt 2
UPenn on Rails pt 2UPenn on Rails pt 2
UPenn on Rails pt 2
 
Ruby is an Acceptable Lisp
Ruby is an Acceptable LispRuby is an Acceptable Lisp
Ruby is an Acceptable Lisp
 
Trading with opensource tools, two years later
Trading with opensource tools, two years laterTrading with opensource tools, two years later
Trading with opensource tools, two years later
 
Converting your JS library to a jQuery plugin
Converting your JS library to a jQuery pluginConverting your JS library to a jQuery plugin
Converting your JS library to a jQuery plugin
 
Your Library Sucks, and why you should use it.
Your Library Sucks, and why you should use it.Your Library Sucks, and why you should use it.
Your Library Sucks, and why you should use it.
 
Building Modern and Secure PHP Applications – Codementor Office Hours with Be...
Building Modern and Secure PHP Applications – Codementor Office Hours with Be...Building Modern and Secure PHP Applications – Codementor Office Hours with Be...
Building Modern and Secure PHP Applications – Codementor Office Hours with Be...
 
"Lego Programming" with Lorzy
"Lego Programming" with Lorzy"Lego Programming" with Lorzy
"Lego Programming" with Lorzy
 
Sf2 wtf
Sf2 wtfSf2 wtf
Sf2 wtf
 

Similar to My Adventures In Objective-C (A Rubyists Perspective)

MacRuby & RubyMotion - Madridrb May 2012
MacRuby & RubyMotion - Madridrb May 2012MacRuby & RubyMotion - Madridrb May 2012
MacRuby & RubyMotion - Madridrb May 2012
Mark Villacampa
 
iOS 2 - The practical Stuff
iOS 2 - The practical StuffiOS 2 - The practical Stuff
iOS 2 - The practical Stuff
Petr Dvorak
 
JavaScript for PHP developers
JavaScript for PHP developersJavaScript for PHP developers
JavaScript for PHP developers
Stoyan Stefanov
 

Similar to My Adventures In Objective-C (A Rubyists Perspective) (20)

Objective-C & iPhone for .NET Developers
Objective-C & iPhone for .NET DevelopersObjective-C & iPhone for .NET Developers
Objective-C & iPhone for .NET Developers
 
Origins of Elixir programming language
Origins of Elixir programming languageOrigins of Elixir programming language
Origins of Elixir programming language
 
RubyMotion
RubyMotionRubyMotion
RubyMotion
 
MacRuby & RubyMotion - Madridrb May 2012
MacRuby & RubyMotion - Madridrb May 2012MacRuby & RubyMotion - Madridrb May 2012
MacRuby & RubyMotion - Madridrb May 2012
 
iOS Einführung am Beispiel von play NEXT TEE
iOS Einführung am Beispiel von play NEXT TEEiOS Einführung am Beispiel von play NEXT TEE
iOS Einführung am Beispiel von play NEXT TEE
 
Corinna-2023.pptx
Corinna-2023.pptxCorinna-2023.pptx
Corinna-2023.pptx
 
Swift, functional programming, and the future of Objective-C
Swift, functional programming, and the future of Objective-CSwift, functional programming, and the future of Objective-C
Swift, functional programming, and the future of Objective-C
 
Iphone course 1
Iphone course 1Iphone course 1
Iphone course 1
 
Three Objectionable Things
Three Objectionable ThingsThree Objectionable Things
Three Objectionable Things
 
CoreOS in a Nutshell
CoreOS in a NutshellCoreOS in a Nutshell
CoreOS in a Nutshell
 
Onsg11 iphone
Onsg11 iphoneOnsg11 iphone
Onsg11 iphone
 
Having Fun Programming!
Having Fun Programming!Having Fun Programming!
Having Fun Programming!
 
Mac ruby to the max - Brendan G. Lim
Mac ruby to the max - Brendan G. LimMac ruby to the max - Brendan G. Lim
Mac ruby to the max - Brendan G. Lim
 
MacRuby to The Max
MacRuby to The MaxMacRuby to The Max
MacRuby to The Max
 
Ruby seen by a C# developer
Ruby seen by a C# developerRuby seen by a C# developer
Ruby seen by a C# developer
 
Ruby seen from a C# developer
Ruby seen from a C# developerRuby seen from a C# developer
Ruby seen from a C# developer
 
iOS 2 - The practical Stuff
iOS 2 - The practical StuffiOS 2 - The practical Stuff
iOS 2 - The practical Stuff
 
JavaScript for PHP developers
JavaScript for PHP developersJavaScript for PHP developers
JavaScript for PHP developers
 
ESWHO, ESWHAT, ESWOW -- FEDucation -- IBM Design
ESWHO, ESWHAT, ESWOW -- FEDucation -- IBM DesignESWHO, ESWHAT, ESWOW -- FEDucation -- IBM Design
ESWHO, ESWHAT, ESWOW -- FEDucation -- IBM Design
 
Webエンジニアから見たiOS5
Webエンジニアから見たiOS5Webエンジニアから見たiOS5
Webエンジニアから見たiOS5
 

Recently uploaded

Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
UXDXConf
 

Recently uploaded (20)

Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří Karpíšek
 
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
 
AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101
 
The UX of Automation by AJ King, Senior UX Researcher, Ocado
The UX of Automation by AJ King, Senior UX Researcher, OcadoThe UX of Automation by AJ King, Senior UX Researcher, Ocado
The UX of Automation by AJ King, Senior UX Researcher, Ocado
 
Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
 
Top 10 Symfony Development Companies 2024
Top 10 Symfony Development Companies 2024Top 10 Symfony Development Companies 2024
Top 10 Symfony Development Companies 2024
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
 
IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024
 
Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
 
ECS 2024 Teams Premium - Pretty Secure
ECS 2024   Teams Premium - Pretty SecureECS 2024   Teams Premium - Pretty Secure
ECS 2024 Teams Premium - Pretty Secure
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and Planning
 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?
 
THE BEST IPTV in GERMANY for 2024: IPTVreel
THE BEST IPTV in  GERMANY for 2024: IPTVreelTHE BEST IPTV in  GERMANY for 2024: IPTVreel
THE BEST IPTV in GERMANY for 2024: IPTVreel
 
Connecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAKConnecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAK
 

My Adventures In Objective-C (A Rubyists Perspective)

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n