The Learning Curve

Tuesday, November 14, 2006

Cocoa's got a steep learning curve. It was really steep for me anyway. Of course, you don't realize this type of thing until it's too late.

I've been a programmer for a long time. I've developed applications with six other languages, and even mastered the Macintosh Toolbox. So I wasn't too worried about learning a new computer language. I was naive.

Like most aspiring Cocoa developers, I started out by installing Apple's developer tools and then I launched Xcode. I figured out how to run a few of the sample programs that were installed with Xcode. You click the "Build and Run" toolbar button and it works. Simple.

Interface Builder was pretty straightforward too. I could take a sample project, move the objects around, run the example again from Xcode and see my changes. w00t!

OK, I was ready to try creating a new application. I really didn't want to create anything specific. Just a simple application that would launch, display a window and have a menu bar, and then would quit properly.

I figured I'd start by selecting New Project from the File menu. That's what I love about Macintosh. Some things are always just right where they're supposed to be.

I got a dialog with lots of choices. Did I want an Action, Application, Audio Unit, Bundle, Command Line Utility...? In all there were about 12 main categories to choose from. But it seemed Application was the right choice. Now in the Application category, I needed to select a specific type of Application: AppleScript, Carbon, Cocoa, Cocoa-Java, or Core Data. I went with "Cocoa Application."

I clicked Next and gave my new project a name: "Dave's First App." I clicked Finish and the project window appeared. I clicked Build and Run, and sure enough, my new application was running. Yeah!

This is where I hit the roadblock. I wasn't able to guess my way past this point.

To get past here, I was going to have to read some documentation. Fortunately, Apple has lots of documentation to read. I found the Getting Started with Cocoa page. It told me that I needed to start with the Cocoa Fundamentals Guide. Then I could move on to the Cocoa Application Tutorial. Then the Xcode Quick Tour Guide, and the Mac OS X Technology Overview, and then Introduction to Interface Builder. Then there are the 14 or so API guides it recommends reading. And then there are more links under the "Next Steps" header. According to Apple this is what you should read just to get started with Cocoa.

It looked like this would take a while. I wanted a shortcut. I wanted somebody to teach me this stuff so I didn't have to figure it out on my own with just a bunch of manuals. I've done that before, but I've always had better luck learning stuff like this in a classroom. If you give me a book, I tend to skip the parts that look boring, or I jump to the end to try to figure out how it's done. I can't do that in a classroom, so I tend to learn quite a bit more.

I'd heard about the Cocoa Bootcamp training offered by Big Nerd Ranch. I'm currently living in Italy, but I figured it might be worth a trip to the States for this training. My timing was great. I saw on their site that Aaron Hillegass was coming to Germany to do the training (in English fortunately). Germany was no problem, since the flight there is about $80 round trip, rather than the $1,500 flight to the States. I spent a few hours trying to build up a good argument to present to my wife about spending €2,800 (about $3,500) on the class, but it turned out my arguments weren't needed. She immediately told me I should go. I signed up for the class the next morning.

The week-long class was held at a monastery (Kloster Eberbach) just outside of Frankfurt. It was a fantastic location for the training. Not to mention the beer is so much better in Germany than it is here in Italy. We spent about a half-day on Objective-C, then after lunch we got into some real Cocoa programming. During the week we worked through most of Aaron's excellent Cocoa Programming for Mac OS X book. Carl-Johan Kihlbom, a fellow classmate, wrote a blog entry about the week. It's worth a read if you want to see what goes on in Aaron's Cocoa class.

I want to give a special thanks here to Stefanie Höfling and Guido Neitzer of Dreamteam Events for organizing the training. It was a ton of fun. I'm even in a picture now on the Big Nerd Ranch website. I'm the one in the sunglasses.

The best thing about the Big Nerd Ranch training was that it gave me a great introduction to Cocoa. I learned how to start thinking like a Cocoa developer. After the class, I understood how to write Objective-C code, how to use the Foundation and Application Kit frameworks, and how to tie my code into the Interface Builder NIB file. I got some experience with Key Value Coding, Cocoa Bindings, Core Data, and much, much more.

Of course, when I got home and tried to write an application it wasn't quite as easy as it seemed to be in class. It's much easier when the instructor is standing there helping you. But when you're on your own, it can take hours to figure out how to do something simple. Working with Cocoa part-time, it actually took me about four months before I felt comfortable with it. But finally, after four months, things really started to click. I got to a point where I actually understood what to do, rather than just trying things to see if they'd work. That was a great feeling.

But the Cocoa frameworks are huge. Even though I'm comfortable with Cocoa now, I still don't know the frameworks very well, so it's a slow process to read through the API reference to find what I need. I'm guessing it will take years before I really know what I'm doing. Right now I find the message archives on CocoaBulder are a huge help. Cocoa Dev Central is also a great place for a beginner to hang out.

Had I known it was going to be this difficult to learn, would I still have started this journey?

Oh yeah. Absolutely!

Add a Comment
Please fill in the fields below to add a comment:
Name*:
Email Address*:
URL:
Spam Protection*:     Type "seattle" without the quotes.
Message*:
  Your email will not be published and the URL provided will be used as
a link on your name.

* indicates a required field.