Archive for August 2010
I spent the past 3 days reading and working through Cocoa and Objective-C: Up and Running, by Scott Stevenson. I own 5 or 6 “beginner” books about Cocoa and Objective-C. This is one of the better ones, with the condition that it is not for an absolute programming beginner.
There is a lot of theory at the beginning of the book. In fact, I believe it is not until chapter 8 that the first Cocoa / Interface Builder examples come into play. I was fatigued with theory by the time I reached that point, but was thankful for the background (especially the brief C primer) because most of the material is used in the Cocoa examples at some point.
There are a few spelling and code errors in the book, as is typical with programming books, but none of them were showstoppers. (There is one pesky error on p. 262… the line of code that reads
@synthesize mainWindow; is not necessary and should be removed or the program will not compile.)
My primary disappointment with the presentation of the material is with the Gallery application in Chapter 9. This is the part where all of the concepts from chapters 1-8 come together. Instead of iteratively constructing the application so that it could be built successfully at checkpoints throughout the chapter, the application requires all of the code and interface builder elements in the chapter before it will compile. That’s a lot of code. It took me several hours to enter all of the code into Xcode. Sure, I know that the code is available online, but it helps me to understand it in context if I type it in while I’m reading it.
Wouldn’t you know, of course, that the application didn’t work when I finished the chapter. I sort of expected that, though, since I had to enter so much code before I could compile to check whether I was on the right track. I had a few small spelling errors that the compiler pointed out to me and I fixed. However, after the code successfully compiled, the application still didn’t work. The only indication of the problem was a cryptic line in the console. I suspected a code problem at first, so I reviewed all of it. The code was fine, so I turned to reviewing the .xib files associated with the application. By that point, I was tired and didn’t have the mental acuity to continue.
I sent an email to the author (via an address provided in the book) and he responded in a timely manner, instructing me to take a more careful look at the .xib files and offering to review my project for me. I appreciate that type of feedback. I thanked him but took to the .xib file and discovered where the error was. After a few minutes of hunting (thanks to the author for direction), I isolated the problem and the application ran.
The chapters that follow the Gallery application are of particular interest to me, about type and drawing. They were a little shallow in their presentation and left we wondering how to combine different graphics appropriately. I’ll have to look for another book to fill those gaps.
Overall, Cocoa and Objective-C: Up and Running is a good introduction to Mac programming for people with a little bit of previous programming experience. This is NOT a good book for an absolute beginner, but should work well for anybody with 4-6 months of experience with other languages under their belt. The book is loaded with material, making it a very good reference to have on hand, too.
Recommendation: Buy Now if you aren’t a total beginner. Buy Later if you need to learn basic concepts of programming first.
(For basics, I recommend Learning Processing, by Daniel Shiffman.)
There’s a theory that people are more likely to complete tasks that they announce publicly. I’m going to give that a shot. I’ve taught myself how to do a variety of beginner to intermediate things in a handful of programming languages. In fact, the most frequently visited posts on this blog are to the solutions that I posted to the Hillegass Cocoa book.
Working through books is both a plus and a minus to me. I get bored with the exercises because they rarely are meaningful — only small simple snippets to teach a concept. What I really would like is a full-fledged tutorial that goes from launching Xcode to completing an application of moderate complexity that serves a useful purpose. This tutorial would explain concepts as it went along; perhaps it would be more of a draw-by-numbers exercise than a standard programming tutorial.
Nevertheless, I have yet to find such a tutorial or book. I therefore am going to use the resources available to me to try to create a simple Cocoa application that serves a useful purpose (to me). Said application will generate population pyramids similar to those in the previous post. I hope to learn more about programming in Obj-C and Cocoa during the process. I’ll post my progress and results here and make the code available on github.