Slashdot is powered by your submissions, so send in your scoop

 



Forgot your password?
typodupeerror
×
Programming Books Media Businesses Book Reviews Apple IT Technology

Core Mac OS X and Unix Programming 212

Michael McCracken writes "Finally, a new OS X programming book that isn't just another introduction to Cocoa. This book adds a lot to the available references by covering the system as a flavor of Unix, presenting information on important topics like sockets, multithreading and pipes, which other OS X books leave out. It also includes coverage and sample code for some of the unfamiliar new technologies that have been introduced recently, such as the Keychain, Rendezvous (aka Zeroconf), and using the Security framework to authorize users." Read on for the rest of his review.
Core Mac OS X and Unix Programming
author Mark Dalrymple and Aaron Hillegass
pages 541
publisher Big Nerd Ranch
rating 9
reviewer Michael McCracken
ISBN 0974078506
summary A developer's guide to the Unix foundations of Mac OS X, including coverage of recently added technologies. Includes complete source code and online companion material.

If you've been learning Mac OS X Cocoa programming, you might already know Aaron Hillegass through his excellent book Cocoa Programming for Mac OS X, which was one of the first good introductory books on the topic, and is still one of the best available. Information about this earlier book can be found at bignerdranch.com/Book/. Both Aaron and Mark are instructors at the Big Nerd Ranch, which offers courses in Mac OS X programming. More information about them and the courses can be found at http://www.bignerdranch.com/Company/Who.html. This book is based on the course with the same name at the Big Nerd Ranch. The book's website and a link to order it online can be found at borkware.com/corebook/ . Discussion and further information for both books can be found at cocoadev.com/index.pl?CocoaBooks.

Audience and Writing Style

This book is not an introduction to programming on OS X. It doesn't explicitly cover how to use Apple's Project Builder or Interface Builder, or much of the Cocoa or Carbon APIs, except during discussion of code examples. So if you're entirely new to programming or to using Mac OS X, start with a different book such as Hillegass' earlier Cocoa Programming for Mac OS X to get up to speed with using the development environment. This book will leave you behind at times if you are unfamiliar with using the command line, however, the examples are complete enough to follow along by just typing in what's in the book.

Core Mac OS X and Unix Programming does have some very basic material in its first few chapters. They focus on the details of C programming, using the compiler, memory management, and debugging. These chapters will be mostly review for anyone who's developed in C on Unix before, but will be invaluable for programmers who learned to program using Java, for instance. They should also be required reading for programmers who started programming with Objective-C and Cocoa and are still unsure about using "plain" C. If you've ever complained about having to use a C API from CoreFoundation in your nice pure Cocoa application, don't avoid this book -- you need to read it even more.

The book is clearly written and easily understood. The writing is occasionally conversational, in keeping with its history as a course textbook. In the grand history of well-written technical books, it is also occasionally funny. The authors don't try to sell the technologies they discuss, instead giving practical advice that's useful to a programmer who is trying to actually build something. For example, the authors discuss bugs and inconsistencies in the system, clumsy API design and other problems that aren't great ad copy but you will need to know to develop robust applications.

I found this aspect of the book one of the most appealing, that it felt as though I was actually getting down to business. Gems of practical advice that can cut short frustrating problems appear throughout the book, so be sure to read carefully, don't just skim.

Hits

Here I'll discuss a few examples of where I think this book really shines. First, the level of detail of the standard Unix APIs and the development tools is excellent -- I learned many immediately useful things in the first 13 chapters. For example, chapter 8, "Debugging With GDB," was not simply a repeat of the online help, but also contained useful tips about how to use GDB more effectively, from using Objective-C specific features to tracking subtle memory errors. Programmers who had only used Project Builder's interface to GDB will benefit greatly from this chapter.

Next, there is pervasive sample code. Each chapter had a complete sample program demonstrating the topic at hand. Much of this code is also available online: see "Online Supplements" below.

Finally, as I mentioned before, the text contains tips and reminders throughout about potential mistakes, tricky problems, and differences between Mac OS X, OS 9, and other Unix flavors. A particularly useful example of this is in chapter 24, "CVS." There is a small but important paragraph that discusses using CVS 1.11 (as used in Sourceforge) with Interface Builder .nib files that can really save some grief. In other chapters, they even include workarounds for system bugs in some of the sample code. This pragmatic approach is really appealing.

Misses

In this section I'll mention a couple potential disappointments. You will have to be willing to learn by just reading code at times. Most of the code examples are not explained line-by-line as is the custom in tutorial books. Comments explain tricky code, and the text covers the areas most relevant to the chapter topic, but for other sections, understanding is up to you. I mentioned this because although I feel the code is clear and a fair trade-off was made to fit in a lot of information, the amount of explanation you like is a matter of personal preference, and so you should know what to expect.

Pointers to further reading is another problem. Aside from referring to man pages, there is little attempt to point to good external documentation on any of the more complicated topics. One chapter is not enough to completely cover BSD Sockets, for example, and so a reference to a Unix network programming book would be useful. In fact, every chapter could be improved by a references section, even if it only collected links to Apple online documentation or Unix community websites. With all the practical knowledge in this book, the lack of clues on where to look to answer your own questions was disappointing.

Finally, the cost of the book, at $97.95, is higher than you might expect. I admit that as a student, I would have to think twice about paying this price, although I am sure it would be easily justifiable for professional programmers. I believe that it is worth the price, however, because you would have to buy several other books to cover the same range of topics, and you still wouldn't get the Mac OS X specific information.

Online Supplements

The authors have set up a promising resource for the book at http://borkware.com/corebook/ . The site includes the sample code, errata, reader comments indexed by the chapter and topic they refer to, and a general discussion board. There are already some errors listed, and a few pointers to useful documentation and interesting external discussions on mailing lists. The sample code is not complete at the time of this review, but more is being added. This site looks like it will be a useful addition to the book, especially if many good chapter-indexed comments are added. The site could be kept open as a reading companion while going over a chapter in the book. This site's organization is, in my opinion, much more useful and usable than other books' companion websites, including the site for "Cocoa Progamming," which hid its information from you unless you knew which page number was relevant to your topic.

Conclusion

Core Mac OS X and Unix Programming is a very useful book, and even if you've been developing on Unix systems for years, you can probably learn a few immediately useful things by reading it. I recommend it for any serious Mac OS X programmer who wants to know what to read next after all the tutorials that have come out in the last year or so. I suspect it'll become a canonical reference, and may even be in need of a clever nickname. Congratulations to Mark and Aaron on a job well done.


Michael McCracken is a grad student and Mac OS X developer; he says "I have not attended any Big Nerd Ranch courses, nor have I met either author, although I did see Aaron Hillegass in a crowd once." Update: 07/02 17:36 GMT by T : According to publisher AtlasBooks, bn.com won't actually be carrying this book, but you can get it right now from Atlas. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

This discussion has been archived. No new comments can be posted.

Core Mac OS X and Unix Programming

Comments Filter:
  • Microsoft port (Score:2, Interesting)

    by SolidGold ( 86023 ) on Wednesday July 02, 2003 @12:04PM (#6350367)
    It is interesting to note that Microsoft in a previous article said that they had no intention of porting Office to Linux right now, but being that they have ported it to OS X most of the work has already been done.
  • Just wondering... (Score:5, Interesting)

    by rampant mac ( 561036 ) on Wednesday July 02, 2003 @12:12PM (#6350464)
    Those WWDC people who have access to Apple's upcoming OS, Panther...

    How relevant will this information be with Panther merging to BSD 5.0 userland and the new Xoode environment?

    I can't seem to justify the price for this book ... yet.

  • Re:C'mon! (Score:3, Interesting)

    by bladernr ( 683269 ) on Wednesday July 02, 2003 @12:19PM (#6350545)
    I have found the command-line essential, even when programming Windows. Even though the Mac (a system I have never been a developer on, but may learn) has a terrific UI, leaving out the command-line would be a mistake, and the author was right to include that content.

    When programmers are beginning, it is easy to avoid the command-line altogether, since their projects are probably simpler. I imagine that the author's previous books on introductory topics focused on the GUI.

    I am a software professional as well, and specialize in large distributed systems and massive-parallel (I can never spell that word) processing. No matter how good the tools, you can never escape from the command-line for complex systems.

    Its been a long time since I've developed single-tier, single-user apps, so perhaps my knowledge of tools in those areas is dated, and you can develop those without command-line usage. Someone else will have to educate me on that.

  • Re:Microsoft port (Score:5, Interesting)

    by Graff ( 532189 ) on Wednesday July 02, 2003 @12:25PM (#6350609)
    Microsoft in a previous article said that they had no intention of porting Office to Linux right now, but being that they have ported it to OS X most of the work has already been done.

    Actually that's not quite true. Microsoft programmed Office for the Mac using the Carbon API and libraries which are part of MacOS. This is a set of APIs which are completely proprietary to MacOS and which bring a program no closer to Linux than a program which uses the Windows API program does.

    The only way in which doing a MacOS port of a program brings it closer to doing a Linux port is most programmers doing a port tend to separate out the parts of the program which rely on a particular operating system from the parts that are platform-agnostic. Thus you will most likely end up with a large chunk of the code which can be re-used to add a front end for any particular system type. This is not a requirement for a port however, it is just smart programming. In fact, it is even smarter programming to do this in the first place. Microsoft may or may not have done this, but I'm doubting that they did. From what I understand they basically program the Mac versions of their programs from nearly the ground up.

    In programming the Myth series of games, it was often said by the developers at Bungie that the platform-agnostic parts of the games took up about 90% of the code, while each port took up 10% more. So for a 10% investment in additional coding you could sell the game to a another platform. This requires a bit of planning but it is a much better way to program than to do one version for one platform and then have to completely redo you work to get it to run on another. Finally, there is another great advantage to doing multi-platform programming. Often a bug which doesn't show on one platform will show up on another, allowing you to clean up any possible problems before they get you into trouble later on.
  • Re:keychain (Score:2, Interesting)

    by markd ( 36343 ) on Wednesday July 02, 2003 @12:31PM (#6350683) Homepage
    The Keychain API shown in the book is the Security Framework version (SecKeychain*)
  • Re:C'mon! (Score:3, Interesting)

    by redtoade ( 51167 ) on Wednesday July 02, 2003 @01:07PM (#6351015) Homepage Journal
    "If anything, people who don't use a command line are smarter than you because they're cutting down on keystrokes, thus improving their productivity."


    As a new emacs user I'd disagree.

    GUIs have their place... sure. For example, it is much easier to do simple "drag and drop" style data mangement in MSAccess, than it is to write UPDATE queries in straight SQL.

    But, emacs has tons of shortcut features that puts it on the same playing field as "point and click." Tab completion, lisp routines bound to Ctrl keys, split windows/mulitple buffers, etc...

    You'll find that you actually save time by your fingers never leaving the keyboard than you will with the standard move mouse, type keys, move mouse, type keys...

    And you can run a shell (command line) within emacs. In fact I think my RH 8/bash install uses emacs as it's default shell editor. So most of these features are available on the command line.

    You can run bash in OSX right? So I would think that all of these features would also be available to Mac users now.

    In fact it's not just emacs... MSWindows has shortcuts in all of it's Office programs. They may not be used as frequently as the pull down menus, but they exist for those people who have gained a familiarity with the program. I've been using them for years in Excel and Word, frankly because it's easier to Ctrl+F to open the search dialog than it is to pull it down with the mouse.

    I would have agreed with your point (although not with your tone) a few months ago, but now that I've had some experience with keyboard only shortcuts... I can see why the alpha geeks view "point and click" as too damn slow.
  • Re:Just wondering... (Score:3, Interesting)

    by markd ( 36343 ) on Wednesday July 02, 2003 @01:18PM (#6351105) Homepage
    From what I saw at WWDC, only a couple minor points here and there will need to be updated (like the new exception mechanism in objective-C replacing the setjmp/longjmp one that currently exists). The tech addressed by this book is more at the plumbing level which doesn't change a whole lot release to release. We don't dwell a lot on the IDE, figuring that folks will know what they're doing in their IDE of choice. (I personally use emacs for my day-to-day work)

Old programmers never die, they just hit account block limit.

Working...