Objective-cRui Peres
Whatis?
Advantages?
Wrapitup..
Sexta-feira, 26 de Julho de 13
Objectivewhat?
Language appeared around the early 80’s @ NeXT
It’s nothing more than a thin layer on top of C
Object-Orien...
“Talkischeap.Showmethecode”
LinusTorvalds
Person *person = [[Person alloc] init];
[person setFirstName:@"Linus"];
[person ...
Andevenmorecode.....+ (NSURLRequest *)requestFromDictionary:(NSDictionary *)parametersDictionary
{
NSURL *webserviceURL = ...
NS,NSeverywhere!
No concept of or . So to keep classes with the same name
without having conflicts, we put a before the na...
Timetorun.NETdevs...
NoGarbageCollector
Yup,youneedtodoitmanually
(likerealmen)
Forgottomention,youalsoworkwithpointers(no...
Sohowdoyoudoit?
Told you it was easy...
Sexta-feira, 26 de Julho de 13
Bigdeal...Sowhatarethe
advantages?
Dynamicnature (it’s really fun!)
Memory managment is done @ compile time
EnforcestheMVC...
Ok,andthebadpart?
Steeplearningcurve,mostlybecauseof
Sinceit’sbasicallyC,you tounderstandwhat’sgoingonbelow
Cangetverbose,...
Questions
&
Answers
I dare you, I double
dare you @%”!
Sexta-feira, 26 de Julho de 13
thanks!
Sexta-feira, 26 de Julho de 13
Upcoming SlideShare
Loading in …5
×

Objective c

420 views
358 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
420
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
14
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Objective c

  1. 1. Objective-cRui Peres Whatis? Advantages? Wrapitup.. Sexta-feira, 26 de Julho de 13
  2. 2. Objectivewhat? Language appeared around the early 80’s @ NeXT It’s nothing more than a thin layer on top of C Object-OrientedLanguage with SmallTalk-Style messaging Can be compiled with GCC, so you can try it on Windows! Sexta-feira, 26 de Julho de 13
  3. 3. “Talkischeap.Showmethecode” LinusTorvalds Person *person = [[Person alloc] init]; [person setFirstName:@"Linus"]; [person setLastName:@"Torvalds"]; NSLog(@"Talk is indeed cheap - %@ %@", [person firstName], [person lastName]); Object allocation Setter’s A simple print, that takes the 2nd and 3rd parameter value and replaces the %@’s It’s called a formatter specifier, if you wonder Getter Sexta-feira, 26 de Julho de 13
  4. 4. Andevenmorecode.....+ (NSURLRequest *)requestFromDictionary:(NSDictionary *)parametersDictionary { NSURL *webserviceURL = [SFBucketCallsManager buildURLFromParameters:parametersDictionary]; SFAccountInfo *accountInfo = [parametersDictionary objectForKey:WS_ACCOUNT_INFO_KEY]; // Get the user's name and password NSString *userName = accountInfo.accountName; NSString *password = accountInfo.accountPassword; // Transform the Username & Password to base64 NSString *authStr = [NSString stringWithFormat:@"%@:%@",userName, password]; NSData *authData = [authStr dataUsingEncoding:NSASCIIStringEncoding]; NSString *authValue = [NSString stringWithFormat:@"Basic %@", [authData base64EncodedString]]; // Creation of the Request NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:webserviceURL]; [request setValue:authValue forHTTPHeaderField:AUTH]; [request setHTTPMethod:[parametersDictionary objectForKey:WS_METHOD]]; [request setTimeoutInterval:15.f]; [request setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData]; if ([parametersDictionary objectForKey:WS_REQUEST_BODY_KEY]) { NSString *postString = [parametersDictionary objectForKey:WS_REQUEST_BODY_KEY]; [request setHTTPBody:[postString dataUsingEncoding:NSUTF8StringEncoding]]; } return request; } Sexta-feira, 26 de Julho de 13
  5. 5. NS,NSeverywhere! No concept of or . So to keep classes with the same name without having conflicts, we put a before the name of the class.Prefix packages namespaces So....... NSArray NSString NSLog NSDictionaryNSInteger NSSet NSConnection NSURL NSObject NSOperation NSDate NSData +around220... NSCoding Sexta-feira, 26 de Julho de 13
  6. 6. Timetorun.NETdevs... NoGarbageCollector Yup,youneedtodoitmanually (likerealmen) Forgottomention,youalsoworkwithpointers(noneedtocryladies) Sexta-feira, 26 de Julho de 13
  7. 7. Sohowdoyoudoit? Told you it was easy... Sexta-feira, 26 de Julho de 13
  8. 8. Bigdeal...Sowhatarethe advantages? Dynamicnature (it’s really fun!) Memory managment is done @ compile time EnforcestheMVCpattern Language designed with large code bases in mind YoucanmixCinyourcode!(now we are getting somewhere) Icouldkeepgoing.... Sexta-feira, 26 de Julho de 13
  9. 9. Ok,andthebadpart? Steeplearningcurve,mostlybecauseof Sinceit’sbasicallyC,you tounderstandwhat’sgoingonbelow Cangetverbose,ifyouarenotcareful... shouldtry Communitycouldbebetter Xcode.:) manualmemorymanagement Sexta-feira, 26 de Julho de 13
  10. 10. Questions & Answers I dare you, I double dare you @%”! Sexta-feira, 26 de Julho de 13
  11. 11. thanks! Sexta-feira, 26 de Julho de 13

×