Deer Attacks Car

pic of car after we hit the deer

It was bound to happen sooner or later living where I do. I hit a deer with my car tonight. No people were harmed and the deer didn’t hang around to answer questions. Minor damage to the hood, “grill”, and cracked the headlight of my Scion xA. Click the thumbnail above for a larger view.

The Dark Side of Obj-C

To offset the enthusiasm of my earlier posts on Objective-C, here is a list of annoying stuff about Objective-C and Xcode…

  1. Header Files. Really, two files for one class is a pain in neck. I’m seriously tempted to write a tool to read the source files and create the headers for me.
  2. Lack of refactoring support in Xcode.
  3. Remembering to put ‘@’ before NSString literals.

Maybe I’m just grouchy because my neck has been hurting for three days straight.

My First Objective-C App

200601161920
Above is a screen shot (click the thumbnails for larger shots) of my first working Objective-C application that wasn’t built following along from the book. If fact, I did some stuff the isn’t talked about in Cocoa Programming for Mac OS X 2nd Edition like the toolbars. Yeah, I need to work on my icon skills. I actually finished this app a week or two ago. It is a goofy little program to help me track the amount of soda I drink every day so I can try to cut back. This is sort of a trial run at a larger program for tracking mine exercise and caloric-intake.

It was very easy to write. Between creating and connecting objects in the nib files and the bindings framework, it didn’t really require much code at all. I am surprised that the Interface Builder doesn’t have support for toolbars.

Learning Cocoa

I’m about halfway though Aaron Hillegass’s Cocoa Programming for Mac OS X Second Edition (ISBN 0-321-21314-9). All I can say is “wow”. I thought Objective-C was going to be a pain because it lacks a garbage collector, but even without a GC Cocoa way more efficient than Java/Swing. I know, it’s an apples and oranges comparing an application framework with a widget toolkit. But Objective-C is simply a better fit of GUI programing. Property change support is built into every object without requiring a lot of boilerplate code. The widgets invoke actions with a target and selector instead subclassing interfaces (you can use trampolines in Java get the same sort of savings). Yeah, Objective-C has got it’s problems (flat class namespace) but it is nowhere near a painful as I thought. I wish I’d bought this book a year ago.