Objective-C Java
@interface &
@implementation
class
@protocol interface
#import // files! import // classes!
categories n/a
id n/a
Slide 25
Slide 25 text
• Thin layer around C
• Message-dispatch runtime
• Static and dynamic (you choose)
• The “real” father of Java:
• http://cs.gmu.edu/~sean/stuff/java-objc.html
Slide 26
Slide 26 text
• Single inheritance + interfaces (“@protocols”)
• @protocols can have optional methods
• Fields protected by default
• All methods are virtual and overridable
• Methods can be added to existing classes
• Full introspection / reflection
• Messages can be intercepted and forwarded
• à la AOP!
Slide 27
Slide 27 text
Cocoa Touch
Slide 28
Slide 28 text
No content
Slide 29
Slide 29 text
No content
Slide 30
Slide 30 text
iPhone Specifics
Slide 31
Slide 31 text
No content
Slide 32
Slide 32 text
128 or 256 MB RAM
Slide 33
Slide 33 text
~70 MB for the OS!
Slide 34
Slide 34 text
no swap file
Slide 35
Slide 35 text
(no virtual memory)
Slide 36
Slide 36 text
no garbage collector
Slide 37
Slide 37 text
(manual memory
management)
Slide 38
Slide 38 text
http://cocoadevcentral.com/d/learn_objectivec/
Slide 39
Slide 39 text
no automatic objects
on the stack (C++)
Slide 40
Slide 40 text
// C++
// Memory freed when out of scope
std::string name(“Adrian”);
std::string *name = NULL;
name = new std::string(“Adrian”);
delete name;