TweetFollow Us on Twitter

Book Review: Mac OS X Advanced Development Techniques

Volume Number: 19 (2003)
Issue Number: 7
Column Tag: Reviews

Book Review: Mac OS X Advanced Development Techniques

by Ron Davis

I have to confess that I worked with Joe Zobkiw on my first job out of college working on Virex almost ten years ago. I was one of the tech reviewers for his previous book A Fragment of Your Imagination, which covered the esoteric programming arts of init, cdev, and other code fragments. It was one of those books that covered stuff no other book covered, the really low level crap most of us attempt to avoid. At the time there was next to no documentation on coding these things and Zobkiw's book was written to meet that need.

Mac OS X Advanced Development Techniques (MADT) is like that book. Not that it talks about the stuff you are trying to avoid writing, but it is talking about the things no one else is. There isn't as much low level stuff you can mess with in OSX, but there are a lot of little nooks and crannies of code that need explanations. Need to write a System Preference panel? It's there. How about adding one of those system-wide menus? Got you covered. They're called Status Items, Chapter 9. Screen saver? Chapter 10.

It also covers some less stand-alone stuff, like threads, frameworks and how to talk between a Cocoa app and a command-line tool. There is also a good chapter of "snippets", little pieces of code you often want, but that don't merit a long discussion.

Section 1: Overview

In my opinion, this book is really aimed at the experienced OSX developer. The introduction says anyone who can compile a program in Project Builder can use it. I think you probably need a little more experience than that. I was interested in the book as a follow up to the various OSX development books I already had. If you have no understanding of Cocoa and want to write a screensaver, this book may not be the place to start.

Given the level of experience required for the book, I thought the first chapter was a waste of time. It is a very high level overview of MacOS in general and MacOS development. Most people already know about Quartz, Project Builder, FreeBSD.

The second chapter at first looked like more of the same, but I found the brief descriptions of the all of the developer applications helpful, if a little shallow. Especially interesting was the listing of command line tools useful to the developer.

Another general thing about the book. Zobkiw is a long time developer of Mac software and this book is plainly written assuming you are coming from a Mac background. If you're a Windows user or a UNIX guy, some stuff might go right by you, but none of it is really critical.

Section 2: Application Level

The first chapter with code in it is a document-based Cocoa app. This isn't a simple text edit style doc app either, but an app that watches Doppler radar pictures on the web and alerts you when a color in them change. I like that. I don't need another simple simple application, I want something that shows me a lot while it teaches the basics of a document based app.

The book also doesn't go through creation of the project step by step, but assumes you downloaded the project and just need it explained to you. This is appropriate for an advanced audience.

The only problem I had with the app was the document class uses readFromFile:ofType: and writeToFile:ofType instead of dataRepresentationOfType: and loadDataRepresentation:ofType which are what the standard document template creates for you. Nor does he mention these other routines and explain why one would be better or worse than the other.

The next two chapters discuss plug-ins, both Carbon and Cocoa. It is a very useful overview and explanation of how the various plug-in architectures work in OSX.

The last chapter in this section covers Frameworks, showing how to build both a Carbon and Cocoa version of a simple Framework.

Section 3: Enhancing the System

The second section of the book was advanced topics for the application writer. The third section covers how to build unusual non-applications. Specifically System Services, System Preference Panes, Status Items (system-wide menus), Screen Effects (screen savers), and Color pickers.

You've probably noticed the Services sub-menu of a lot of apps. Under 10.1 this was a dead give away you were using a Cocoa, but 10.2 made them available to Carbon apps as well. They are programs, normally faceless, that interact with the current selection. Zobkiw explains how to write one of these services, creating an example that changes the case of the selected text.

Next Zobkiw talks about how to write a System Preference panel. This allows you to provide a basic UI for faceless application that run all of the time. The example in this chapter sets the preference for the Service created in the previous chapter.

Zobkiw gives an informative discussion of the various kinds of little menus that are displayed in the menu bar on the right side. Some of these are Status Items, some of them Menu Extras. Technically, we developers are only allowed to create Status Items; Menu Extras are reserved for Apple. The example in this chapter is of a Status Item and not a Menu Extra.

I was always a little jealous of how Windows has a standard screen saver mechanism and OS9 didn't. Well that changed in OSX and now you can very easily write those screen savers yourself. They're so easy the chapter explaining them is only 7 pages long. It is still a good introduction that leaves you with a place to start writing your own. If you are going to do a lot of Screen Effects work, you will want to get Saver Lab (http://www.dozingcat.com/), which allows you to run your screen saver in a window for debugging.

The last esoteric piece of code in this section is a Color Picker. The OSX Color Picker is actually a collection of pickers. When you open it there is a list of icon buttons at the top of the window that let you pick from a number of pickers. Third party developers can create their own picker panels using Cocoa. Chapter 11 gives you the details on how to do this.

Section 4: Advanced Methods

Threads is the first of the advanced topics discussed, which gives you an overview of what threads are and how they work, and gives you an example of how to use them.

Terminal is the name of the next chapter, but it is really about NSTask and another thread example. Of all the chapters, this was the one I liked the least, because I felt it didn't really cover the topic and was just kind of wrong. He tells you how to use an NSTask to launch a UNIX command line command, but when he does one that you have to wait to return, he uses a thread that polls for the result. It really should have used the notifications NSTask has built into it. That is the right way to do it and the code would have been simpler.

The last two topics covered by their own chapters were XML-RPC and SOAP. These chapters give a basic introduction to using WebServices both in PHP and Cocoa. The PHP for the server made sense, though I was a little surprised Zobkiw did a PHP client. He also builds a client in Cocoa using the WebServices API in CoreServices. These two chapters are very similar. If you have a preference for one remote procedure call methodology over the other, you probably only need to read one of these chapters.

The last chapter of the book is a collection of snippets. Bits and pieces of code that you will find useful, but don't rate a full chapter. This may be the section you find most useful.

Summary

Overall I would say this book is a must have for a complete Cocoa bookshelf. It covers topics no other book covers and does it in a concise, referenceable way.


Ron Davis is a long time Macintosh Software Engineer, having worked for companies like Apple, and Metrowerks on a variety of products from development tools to anti-virus software. His day job is working for Alsoft, and his evening job is R.A.D. Productions, makers of Suck It Down and FinderEye.

 

Community Search:
MacTech Search:

Software Updates via MacUpdate

Latest Forum Discussions

See All

Fresh From the Land Down Under – The Tou...
After a two week hiatus, we are back with another episode of The TouchArcade Show. Eli is fresh off his trip to Australia, which according to him is very similar to America but more upside down. Also kangaroos all over. Other topics this week... | Read more »
TouchArcade Game of the Week: ‘Dungeon T...
I’m a little conflicted on this week’s pick. Pretty much everyone knows the legend of Dungeon Raid, the match-3 RPG hybrid that took the world by storm way back in 2011. Everyone at the time was obsessed with it, but for whatever reason the... | Read more »
SwitchArcade Round-Up: Reviews Featuring...
Hello gentle readers, and welcome to the SwitchArcade Round-Up for July 19th, 2024. In today’s article, we finish up the week with the unusual appearance of a review. I’ve spent my time with Hot Lap Racing, and I’m ready to give my verdict. After... | Read more »
Draknek Interview: Alan Hazelden on Thin...
Ever since I played my first release from Draknek & Friends years ago, I knew I wanted to sit down with Alan Hazelden and chat about the team, puzzle games, and much more. | Read more »
The Latest ‘Marvel Snap’ OTA Update Buff...
I don’t know about all of you, my fellow Marvel Snap (Free) players, but these days when I see a balance update I find myself clenching my… teeth and bracing for the impact to my decks. They’ve been pretty spicy of late, after all. How will the... | Read more »
‘Honkai Star Rail’ Version 2.4 “Finest D...
HoYoverse just announced the Honkai Star Rail (Free) version 2.4 “Finest Duel Under the Pristine Blue" update alongside a surprising collaboration. Honkai Star Rail 2.4 follows the 2.3 “Farewell, Penacony" update. Read about that here. | Read more »
‘Vampire Survivors+’ on Apple Arcade Wil...
Earlier this month, Apple revealed that poncle’s excellent Vampire Survivors+ () would be heading to Apple Arcade as a new App Store Great. I reached out to poncle to check in on the DLC for Vampire Survivors+ because only the first two DLCs were... | Read more »
Homerun Clash 2: Legends Derby opens for...
Since launching in 2018, Homerun Clash has performed admirably for HAEGIN, racking up 12 million players all eager to prove they could be the next baseball champions. Well, the title will soon be up for grabs again, as Homerun Clash 2: Legends... | Read more »
‘Neverness to Everness’ Is a Free To Pla...
Perfect World Games and Hotta Studio (Tower of Fantasy) announced a new free to play open world RPG in the form of Neverness to Everness a few days ago (via Gematsu). Neverness to Everness has an urban setting, and the two reveal trailers for it... | Read more »
Meditative Puzzler ‘Ouros’ Coming to iOS...
Ouros is a mediative puzzle game from developer Michael Kamm that launched on PC just a couple of months back, and today it has been revealed that the title is now heading to iOS and Android devices next month. Which is good news I say because this... | Read more »

Price Scanner via MacPrices.net

Amazon is still selling 16-inch MacBook Pros...
Prime Day in July is over, but Amazon is still selling 16-inch Apple MacBook Pros for $500-$600 off MSRP. Shipping is free. These are the lowest prices available this weekend for new 16″ Apple... Read more
Walmart continues to sell clearance 13-inch M...
Walmart continues to offer clearance, but new, Apple 13″ M1 MacBook Airs (8GB RAM, 256GB SSD) online for $699, $300 off original MSRP, in Space Gray, Silver, and Gold colors. These are new MacBooks... Read more
Apple is offering steep discounts, up to $600...
Apple has standard-configuration 16″ M3 Max MacBook Pros available, Certified Refurbished, starting at $2969 and ranging up to $600 off MSRP. Each model features a new outer case, shipping is free,... Read more
Save up to $480 with these 14-inch M3 Pro/M3...
Apple has 14″ M3 Pro and M3 Max MacBook Pros in stock today and available, Certified Refurbished, starting at $1699 and ranging up to $480 off MSRP. Each model features a new outer case, shipping is... Read more
Amazon has clearance 9th-generation WiFi iPad...
Amazon has Apple’s 9th generation 10.2″ WiFi iPads on sale for $80-$100 off MSRP, starting only $249. Their prices are the lowest available for new iPads anywhere: – 10″ 64GB WiFi iPad (Space Gray or... Read more
Apple is offering a $50 discount on 2nd-gener...
Apple has Certified Refurbished White and Midnight HomePods available for $249, Certified Refurbished. That’s $50 off MSRP and the lowest price currently available for a full-size Apple HomePod today... Read more
The latest MacBook Pro sale at Amazon: 16-inc...
Amazon is offering instant discounts on 16″ M3 Pro and 16″ M3 Max MacBook Pros ranging up to $400 off MSRP as part of their early July 4th sale. Shipping is free. These are the lowest prices... Read more
14-inch M3 Pro MacBook Pros with 36GB of RAM...
B&H Photo has 14″ M3 Pro MacBook Pros with 36GB of RAM and 512GB or 1TB SSDs in stock today and on sale for $200 off Apple’s MSRP, each including free 1-2 day shipping: – 14″ M3 Pro MacBook Pro (... Read more
14-inch M3 MacBook Pros with 16GB of RAM on s...
B&H Photo has 14″ M3 MacBook Pros with 16GB of RAM and 512GB or 1TB SSDs in stock today and on sale for $150-$200 off Apple’s MSRP, each including free 1-2 day shipping: – 14″ M3 MacBook Pro (... Read more
Amazon is offering $170-$200 discounts on new...
Amazon is offering a $170-$200 discount on every configuration and color of Apple’s M3-powered 15″ MacBook Airs. Prices start at $1129 for models with 8GB of RAM and 256GB of storage: – 15″ M3... Read more

Jobs Board

*Apple* Systems Engineer - Chenega Corporati...
…LLC,** a **Chenega Professional Services** ' company, is looking for a ** Apple Systems Engineer** to support the Information Technology Operations and Maintenance Read more
Solutions Engineer - *Apple* - SHI (United...
**Job Summary** An Apple Solution Engineer's primary role is tosupport SHI customers in their efforts to select, deploy, and manage Apple operating systems and Read more
*Apple* / Mac Administrator - JAMF Pro - Ame...
Amentum is seeking an ** Apple / Mac Administrator - JAMF Pro** to provide support with the Apple Ecosystem to include hardware and software to join our team and Read more
Operations Associate - *Apple* Blossom Mall...
Operations Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Cashier - *Apple* Blossom Mall - JCPenney (...
Cashier - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Blossom Mall Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.