Uploaded on

 

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
274
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
12
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Objective-cRui Peres Whatis? Advantages? Wrapitup.. Sexta-feira, 26 de Julho de 13
  • 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. “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. 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. 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. Timetorun.NETdevs... NoGarbageCollector Yup,youneedtodoitmanually (likerealmen) Forgottomention,youalsoworkwithpointers(noneedtocryladies) Sexta-feira, 26 de Julho de 13
  • 7. Sohowdoyoudoit? Told you it was easy... Sexta-feira, 26 de Julho de 13
  • 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. Ok,andthebadpart? Steeplearningcurve,mostlybecauseof Sinceit’sbasicallyC,you tounderstandwhat’sgoingonbelow Cangetverbose,ifyouarenotcareful... shouldtry Communitycouldbebetter Xcode.:) manualmemorymanagement Sexta-feira, 26 de Julho de 13
  • 10. Questions & Answers I dare you, I double dare you @%”! Sexta-feira, 26 de Julho de 13
  • 11. thanks! Sexta-feira, 26 de Julho de 13