I'm Writing a Cocoa Book for O'ReillyWriting a book is a fairly crazy thing to do. It's like coming up with 200 essays on a single subject. You can only do it if you really like the thing you're writing about. Fortunately, I really like making Mac software and teaching other people about it, so O'Reilly asked me to turn that into a book.
The book is called Cocoa and Objective-C: Up and Running. It's a ground-level introduction to everything you need to write Cocoa apps. I don't assume you know C or compilers, or anything other other how to use a Mac. It's available now from O'Reilly Rough Cuts. More content will be added before it goes into production later this year.
In short, I took everything I've learned about writing Cocoa tutorials since 2004, cleaned it up, filled in the missing pieces, revamped and updated it for Snow Leopard, and put it all together into one, cohesive walkthrough. If you like the Cocoa articles on Theocacao and the tutorial I wrote for Cocoa Dev Central, I really think you'll like this book.
Who This is For?
I had to figure out who to write for. A book for expert programmers is easier to write because you can assume a lot more; but I wanted to make it possible for anyone to learn Cocoa, even if they had no programming experience. Once I decided on that, though, I had to figure out how to actually do it.
Cocoa is based on Objective-C, which is based on C. So I could write a book on C, then a separate book on Objective-C and Cocoa. The downside is that you could end up wasting time reading about the obscure parts of C that don't apply to modern Mac apps.
Another option is to skip C entirely, and just jump right into Cocoa and Objective-C. I almost went this route, particularly because it's how I learned. But then I remembered how many examples and explanations were going over my head when I was learning because I didn't understand the underlying rules of C. I got a lot of code to work purely by accident.
There's also a good chance that you'll want to use existing C code, and to do that, you need to know how to read and write C. In fact, some of the frameworks in Mac OS X can only be used as C types and functions. And sometimes, you may just need the extra speed of C.
So I asked myself was: "Am I training people to write one-off Cocoa apps, or to be productive Cocoa engineers?" I decided I wanted to make engineers, not just people who can run through basic examples. But it takes time to learn C first, and I want to help you get started right away. So what's the answer?
I decided to teach a core set of C concepts that apply directly to Mac and iPhone programming, leaving out the archaic C conventions that Cocoa has better answers for. So this book has only two chapters on C. They focus on just the parts that you need to be a productive Cocoa programmer.
What If I Already Know C?
The other big decision I made was that the book shouldn't be only for new programmers. I wanted it to be useful for people who already knew C or C++. I know this sounds like hyperbole, but I really mean it. I want to be able able to hand this book to an experienced programmer who's new to the Mac and tell them it will be useful.
So the chapters are setup to be modular. If you already know C, you can skip ahead to the Objective-C chapter. If you've spent some time with the iPhone SDK, you can start with the chapters that cover the frameworks. This was not something I took lightly and was not easy to do, but I think the result will be something that will work for a lot of people.
How Is it Written?
The main job I have in this book is to tell you how Cocoa works in simple terms and a personal voice. The world does not need another big, dense book with distant language. If you read Theocacao or Cocoa Dev Central, the style will probably be familiar, but hopefully even more stripped down.
My editor at O'Reilly, Brian Jepson, encouraged me to talk directly to you, and even write as if we're having a conversation. He also asks questions that he thinks you'll have, and suggests I just answer them directly in the text.
The CocoaBook.com Site
The home base for the book is CocoaBook.com. Please check out the site and share it anyone you know. This is where I'll post the code for the examples, along with any news on new versions or other things that come up along the way. I'm sure a lot of the major developments will end up on Theocacao, too, or you can get updates through my Twitter account.
Now, what about Cocoa Dev Central? There are a lot of useful tutorials there, and some of them need to be updated. The good news is that I talked to O'Reilly about this and they gave their blessing to posting the revamped versions of the existing tutorials back to Cocoa Dev Central (specified as a percentage of the total book content). This is no small thing to me, and they really get why this is important.
The net result is that O'Reilly is getting a book while still enabling Cocoa Dev Central to be useful resource for Cocoa developers, which I think is pretty fantastic. Outdated content will be refreshed and missing pieces will be filled in. Some of the new content will be unique to the book, because we really want you to buy the book. But all of the tutorials that were previously available will stay that way. Nothing is being pulled from the site.
By the way, the reason I want you to buy the book is so that we can do more of this. This isn't my full-time job, and writing a book is pretty hard. But if you guys and girls like this one, I'll write more. Maybe it's too predictable, but I have to pull out the Disney quote that Brent Simmons first turned me on to, and John Gruber recently brought back into the collective consciousness:
"I don't make pictures just to make money. I make money to make more pictures. I'd rather entertain and hope that people learn, than teach and hope that people are entertained." -Walt Disney
I write software for a living, and I enjoy that very much. But I write tutorials because I like helping people learn how to do something that might change their life. I'll keep doing it for as long as you guys want to read it.
I hope you like it.
I'm Writing a Cocoa Book for O'Reilly
Posted Sep 28, 2009 — 34 comments below
Posted Sep 28, 2009 — 34 comments below