Saturday, February 21, 2009

Today is day one!

So I decided to take the plunge and get into some Mac OS X. My first stop as always was Barnes and Noble to get a book to learn from. I decided to pay the "now tax" instead of getting the book online. I'm usually pretty impulsive like that. I also got another book just for fun.

So far in an afternoon, I've made it through five and a half chapters. Objective C is quite a different language than the C# that I'm used to. The cool thing is I sort of get it. By no means do I know anything, but I'm always curious about parallel programming and recently I started reading about Erlang. The only reason I bring it up is after browsing the internet about things Erlang, I was more comfortable with the mental state of passing messages to objects rather than calling methods on them. Once you get over that hurdle, and the syntax to boot, it's actually not all that bad.

The one thing that I'm not ready to get completely used to is XCode. It's no visual studio, and I'm not completely comfortable with the debugger yet, but it's only a few hours into my first excursion. I haven't traveled too far from the book's code, but the challenge exercises. The one thing that is very much so missing is the comfortable autocomplete that I'm used to from visual studio. The autocomplete in XCode isn't bad, but the completion keystrokes are quite limited. Only the arrow key or enter seem to complete a word, not space, tab, ;, ), ], or any of the other non-alphanumerics that complete a work THEN insert that character. There is an option to add a "complete" keystroke, but if it's something that you can type after a keyword, then it'll never get inserted. At least that's my initial experience.


So far I've learned how to make interfaces in Interface Builder, this is the part I'm most comfortable with. However I was completely lost when it came to hooking up code to the controls. That's where the book came in and saved the day. Now I can hook up my code to the obvious actions on a control and make buttons work and whatnot. So far I've counted letters in a string, made the computer speak, and generate random numbers. My goal is to get together some of my more recent common C# test applications I've made (color fading, animation, dragging and dropping).

If there's any ideas, I'm willing to entertain them. So far my best idea is to have the computer read you a random joke from the internet somewhere. Not the most interesting, but it's certainly pretty cool.

Harold's code of the day: MyClass *foo = [[MyClass alloc] init];

Harold's cool observation of the day:

In C#, this code will crash:
MyClass foo = null;
int bar = foo.myMethod();



In Objective C, this code will just set bar to 0:
MyClass *foo = nil;
int bar = [foo myMethod];


Makes chaining calls when a potential middle call is NULL so much easier. I don't care if an intermediate step fails, I want to know if the result is kosher. Wish me luck tomorrow!