dacs.doc electric

 

Programming on the Mac
Part II

By Mike Kaltschnee

 

This is the second installment of my journey to learn Cocoa programming on the Mac under OS X. This month I’m going to share my experience in trying to get a simple Cocoa program to run, using three different books as learning tools.

The first book I started with was Learning Cocoa with Objective-C, 2nd Edition, by James Duncan Davidson, published by O’Reilly & Associates (ISBN: 0-596-00301-3). This book is designed to be an introduction to Cocoa, and reminds me a lot of my college programming textbooks. It starts off by getting your first command line and GUI Cocoa programs to run (an important step) and then goes on to explain object-oriented programming (inheritance, methods, etc). I was actually writing working code in less than an hour with the book. This is the first book I’ll finish, going through all of the examples, before moving onto finish the others.

The second book, Cocoa Programming for Mac OS X, by Aaron Hillegass, is published by Addison Wesley (ISBN: 0-201-72683-1). Aaron is also founder of the Big Nerd Ranch, one of the top Cocoa training schools in the country. This was the first book I picked up, due to the recommendations online. It’s not designed for the true beginner, it’s an introduction to Mac programming for Java or C++ programmers. Being so rusty at serious programming, I wound up skimming the first 100 pages of the book, typing in a few examples, absorbing a lot, but I need more background on object-oriented programming and Cocoa before I dive into this book.

The third book I selected to learn Cocoa is Cocoa Recipes for Mac OS X, by Bill Cheeseman, published by Peachpit Press (ISBN: 0-201-87801-1). The thickest of the three, with more than 700 pages, it focuses on building a program that demonstrates many of the features of Cocoa. Bill started archiving and organizing one of the largest Cocoa repositories on the Web at http://www.stepwise.com/StartingPoint/Cocoa.html. I like the book, but the commitment of working with one application for the entire book makes this my last choice, almost a finishing school for what I learn in the other books and online. Skimming through the book, I was able to find examples of many things I’d like to be able to put into my programs, so I’m sure I’ll find this book useful in the future.

Books are a personal choice, so don’t rush out and buy one based on my recommendation. I suggest you go to your local bookstore, pick up several that seem interesting, find a comfy chair, and select the one (or more) that you find useful.

Apple, in addition to providing the very robust Xcode development environment, also provides a lot of documentation in the/developer/documentation/cocoa directory on your hard disk. There are 62 documents in my directory, covering everything from the Objective C language to programming Web services. Several of the books recommend reading Apple’s Object-Oriented Programming and the Objective-C Language document before starting the examples in the book as a good background.

Since Objective C is very closely based on the C language, I would highly recommend the book I used to learn C at my first job and in school, The C Programming Language, (2nd Edition), by Brian W. Kernighan and Dennis Ritchie. A no-nonsense guide to programming, it’s a fast way to learn C. You can use Xcode to build all of the examples in the book, so you don’t need to buy a special compiler to learn C.

On the Web, I discovered a whole series of programming Cocoa articles on O’Reilly’s MacDevCenter.com (http://www.macdevcenter.com/pub/ct/37), including an excellent beginner series for learning how to program in Cocoa. Other great starting points include Ranchero Software (http://www.ranchero.com/cocoa/), and also CocoaDevCentral (http://www.cocoadevcentral.com/).
I “read” the new O’Reilly Mac Developer Journal CD and I like it. It’s full of articles, sample programs, and also takes a look at the business side of creating software (public relations, marketing, etc). The longest-running Mac developer magazine is MacTech (www.MacTech.com). If you’re serious about learning to program on the Mac, you can get a free sample issue by visiting the Web site.

So far, I’m pleased with my progress. I won’t lie to you and say it’s easy to program. It’s a lot of work and you really have to be interested in learning a lot of new concepts. However, the reward of making a program that actually works – and might be useful to others is worth it.

Sorry I missed the January meeting; I got stuck in the snow storm, commuting back from the city. I’ll have free samples of the MacDeveloper Journal CD at the February meeting if you are interested.


You can reach Mike online at mikek@demorgan.com.

BackHomeNext

© Copyright Danbury Area Computer Society, Inc. 1998-2003 All Rights Reserved
Web Site Terms & Conditions of Use