Good laugh, but the truth is more serious. This book, along with every book in this area that I’ve read, and every forum post in any forum that I’ve read, either totally obfuscates the underlying syntax or swans off into foo-land. Which to a beginner is even worse.
Here’s what’s wrong. I’ll give a few examples. The first is from very early on in this book:
The problem with this is in using the apparently same name for two completely different things. Yes, Yes, I know, one starts with a capital P and the syntax makes it obvious that Person and person are different things - but this is just page 66 in an introductory book, and nowhere (that I could find up to that point - I could be wrong) did the author suggest that using a capital P will help differentiate between a class and an instance. At this stage in a book, we need our hands held a lot.
So this following code example is poor from a teaching point of view, since it is very confusing for a newbie. Here, in page 102, we’re creating an instance of our brand new class Person:
Why on Earth could he not have said:
and made it totally clear what was happening? This obfuscation is repeated throughout the book.
I am also working my way through Mark et al’s book on iPhone Development, and it’s even worse. It’s full of stuff like this:
and to be honest he’s not trying to teach Objective-C, but rather than just copying this syntax from Apple’s docs, he could have made it easier for tyros like me by using something like:
to at least show where the reserved variables are required (and some highlighting there would help too, like italics) and where your own stuff can go in - and even though I had already got as far as page 115 in Hillegass before getting to this, I had to actually try out all the combinations in Xcode to see where it fell over, before I knew that the first use of pickerView was essential and had to be exactly that, whereas the second could be anything I liked, provided I used that in the subsequent code. Same with component.
So avoiding keywords in the code examples, apart from where these keywords are required by the syntax, and then highlighting these as keywords, would really, really have made my life a lot easier and my understanding would have come much quicker.
As for Foo and Bar, I don’t know why people use that. It obviously means something to experts, but a newb seeing that stuff is left wondering what these things are. Sometimes they are classes, sometimes they are instance variables, and always that are just a pain in the… foo.