Thursday, July 08, 2010

WWDC 2010 Videos

In the past two weeks, actually since June 26, 2010, I have been watching WWDC 2010 videos. There are total 125 videos, each about one hour time. Now I have 72 left, which may take me at least one more month to finish, two videos a day.

Those are really good talks on Cocoa, Objective-C and iOS or iPhone. Most of them provide detail information about its new features and framework. I think my past years learning on Cocoa and Objective-C, and recent hands-on iPhone development benefit me a lot. Without my past knowledge and experience, it is hard to understand those new videos. I think I am on the right track with Mac and iPhone development.

Recall back the initial days when I was doing iPhone coding, it was too much and overwhelming, since the framework and syntax are so different from .Net and other languages such as JavaScript, PowerShell and Ruby. However, I knew that all those were new for me and I should not bring my past experience in other framework as pre-adjudgement to influence my learning. I tried to not just copy and paste codes. Instead, I just typed all the codes so that I got first experience with the new framework. I think my efforts are worthwhile. Now I feel the power and beauty of this new framework.

For example, the ObjC syntax is very different .Net C# one. The methods are function like: methodName(type par1, ...); while in ObjC, it is methodAndDescriptionWithArg1: descriptionWithArg2:.... ObjC actually is more descriptive and easy to read.

Taking the following C# example:

class MyClass {
...
private bool DoAction(string name,
bool condition1,
int flag)
{...}
...
}
...
obj = new MyClass();
obj.DoAction("some name",
true,
2);

When you use the method with arguments in values, it is really hard to understand the meaning of each argument. You may rely on Visual Studio intelligent hints to get their means.

The similar codes in ObjC:
@interface MyClass : NSObject {
...}

- (BOOL) doActionWithName:(NSString*)name
condition1:(BOOL)value
andFlag:(int)flag;
@end
...
obj = [[MyClass alloc] init];
BOOL result = [obj doActionWithName:"some name"
condition1:YES
andFlag:2];

As you can see the ObjC syntax is more descriptive. Here are two slides in session - 138 API Design for Cocoa and Cocoa Touch, at WWDC10:





As in the comparison, you can see that Apple's OS framework and Objective-C was fundamentally a well structured and designed even back to 1981, unlike other languages just mimic C syntax.

0 comments: