5 things you should know about Cocoa programming

How Cocoa helps programmers produce more.

By James E. Gaskin - This tip comes from David Chisnall, the author of Cocoa Programming Developer's Handbook. Chisnall is active in the object-oriented developer community, and is a major contributor to the GNUstep project that provides an open source implementation of the Cocoa APIs (Application Programmatic Interface).

[ Enter to win a copy of Cocoa Programming Developer's Handbook. Hurry! The drawing ends March 31. ]

1. Like to see a good thing from the past updated for today? Take a look at Cocoa, a set of clean, object-oriented APIs with a constant history of refinement dating back to the 1980s. OS X Cocoa programming tools today are a direct descendent of the original NeXT computer operating system development framework.

2. Don't think Cocoa is limited to Apple programming, even though that's the largest market by far. Cocoa APIs are implemented in GNUstep, the open source development framework that can also create Windows programs.

3. The CocoaTouch framework integrates the iPhone's multitouch interface support for iPhone application developers. iPads are similar to the iPod Touch, but there aren't enough details available yet to see how Cocoa will be supported on the iPad.

4. "Cocoa" is used to mean two things. First is the Cocoa framework, the wrapper that includes just the Foundation and Application Toolkit frameworks. Second, and more extensive, is the "Objective-C frameworks included with OS X." There are many of these, and third-party frameworks provide an even bigger collection of programming tools.

5. Unlike development frameworks that give lip service to object-oriented programming but make it difficult to reuse code modules, Cocoa aims to wring the most output for a programmer's input possible. Following the Objective-C method, Cocoa makes it simple to reuse code.

Write a generic solution to a problem once, and you'll never have to write that code again. Pull it out easily, move it to other programs, and you can even include it as part of your framework for easy reuse in all future programs.

The amount of code you need to write is really small if you're doing things others people are doing, since you can use the fruits of their programming labors. As more solutions from other programmers gets added to the Cocoa foundation tools, subsequent programmers will write less and less to produce more and more. Chisnall quotes Alan Kay, the pioneering programmer, saying "the difference between development with good tools versus bad tools is one or two orders of magnitude."

C++ toolkits create hard to read languages that are difficult for other programmers to see what's going on, even in a team development environment. Java isn't much better. If you want clarity and reusability, check out object-oriented programming in general and Cocoa in specific.

If you're a Mac fan who is new to object-oriented programming, Cocoa is a good place to start. Chisnall recommends reading the first few chapters of programming books to get the background and history so you understand where the language came from. Then, study the parts that appear in every program like the foundation framework and core bits. Regard the rest of the book as a reference for use when needed. That's the way Chisnall laid out his Cocoa book.

Cocoa helps programmers produce more, and makes good solutions available to other programmers. And the Cocoa framework and associated tools certainly helped create some excellent applications for the Macintosh.

ITWorld DealPost: The best in tech deals and discounts.
Shop Tech Products at Amazon