Thursday 10 July 2008

Cocoa: Starting to Learn

As I said previously I'm attempting to teach myself Cocoa and Objective-C programming. My starting point was the advice on the website of the authors of my favourite journal article management system.

...it really isn't that difficult to learn actually. Of course a basic knowledge of C is a prerequisite, but once you have that experience things can go fast. Really fast! Remember we didn't have any programming experience when we started only a few years ago.

...many terrific books for beginners have become available since then. From personal experience we can absolutely recommend these four that will help you take the large hurdle at the beginning, and get you going in no time.

...One of the first things we urge you to do is sign up with Apple's Developer Connection (ADC) for a free (!) online account....


So, I signed up for the basic, free Apple Developer Connection membership and installed the dev tools from the discs that came with my MacBook. My next step was trying to get a clue about how to actually write programs.

I started out reading Stephen Prata's C Primer and learnt some useful basics like putting a semicolon at the end of every statement, declaring variables and where to put the braces to enclose functions. It also covers stuff about how code works, what compilers do and things like that - I to have an understanding of the basic stuff that happens in the background. However, I only got about three chapters into the book when a detailed discussion about the different variable types and the number of bytes of memory that they require completely derailed my interest. This was far too hardcore computer science for me. I understood it but had a feeling that I might not need to know stuff in such insane detail - Cocoa struck me as being too friendly for that kind of knowledge. I closed the C Primer. If I ever have an urge to write code for embedded systems (maybe washing machine engineering will call to me later in life) I might come back and carry on with the rest of the book1.

Next I ventured into Learning Cocoa with Objective-C from O'Reilly. This was considerably better. The writing was much more accessible and it covered some useful basic points of the objective-C language and introduced me to what object oriented programming is. Problems staretd when they started to explain the creation of GUI-based applications rather than command-line tools. The book was published in 2005 and, in the intervening three years, Apple have made a lot of changes to their development tools. 'Project Builder' is now called XCode and both it and Interface Builder have undergone plenty of tweaks to their layout. All of the examples in Learning Cocoa... are based in Project Builder and so it took a considerable amount of time to work out what the hell was going on when told to click a button that had been moved or no longer existed. That wasn't fun. I'd also heard a lot about these cool new features in Leopard to handle data and graphics etc - I really wanted to learn about these because I reckon they'll be useful in the app I want to write.

Whilst thinking about the most appropriate book for my needs I saw an interview with Aaron Hillegass, author of Cocoa Programming for Objective C. In a piece of excellent, fortuitous timing a new edition of the book had just been released that was fully up to date with the most recent release of XCode and all of the new Leopard features. Great news. I've bought a copy and it looks promising.

So, I've found a book. I'll detail my progress with it later...






  1. Anyone who just tutted, sighed and thought "How can you even think about writing code without a full understanding of C?" will be ignored. Life's too short. I'll understand what I need and not a thing more.



No comments: