Cocoa Programming – Part I
This post is the first in a series reviewing the book Cocoa Programming, by Aaron Hillegass.
Let me begin by saying, Aaron’s know the topic of Cocoa programming. As a previous employee of NeXT which merged with Apple, Aaron has extensive experience teaching developers, including many Apple Engineers, how to write applications for Mac OS X.
After a brief history lesson of how NeXT Computer (founded by Steve Jobs upon leaving Apple) evolved and Cocoa came to life, Aaron dives into what most all of us developers crave from the get go, writing an application. Aaron walks through creating a simple program that ties together Xcode (developer IDE), Interface Builder (GUI layout tool) and Objective-C. There’s enough covered here to get the big picture view of how to build applications the Apple way.
The next step (no pun intended) is a closer looker at Objective-C. Although the details are left to other books/references (as would be expected) there is a good coverage of working with classes, basic data structures/types and a smattering of other topics that provide enough information for those who are new to both Cocoa and Objective-C to follow along as the book progresses.
The next chapter is all about memory management. With the release of Mac OS X 10.5 (Leopard) Apple introduced garbage collection as option for memory management. Prior to GC, it was your responsibility as the developer to properly retain and release all objects. One caveat worth mentioning, if you are focused solely on iPhone development, you might as well skim or altogether skip learning about garbage collection as the iPhone does not offer GC support.
The book continues in this very methodical manner: presenting a concept, describing relevant methods within the framework, diagramming object relationships, inserting figures/screenshots, and more often than not, showing code examples to demonstrate concepts. What follows is the list of chapters covered in the book, an extensive list for sure:
Chapter 1. Cocoa: What Is It?
Chapter 2. Let’s Get Started
Chapter 3. Objective-C
Chapter 4. Memory Management
Chapter 5. Target/Action
Chapter 6. Helper Objects
Chapter 7. Key-Value Coding; Key-Value Observing
Chapter 8. NSArrayController
Chapter 9. NSUndoManager
Chapter 10. Archiving
Chapter 11. Basic Core Data
Chapter 12. Nib Files and NSWindowController
Chapter 13. User Defaults
Chapter 14. Using Notifications
Chapter 15. Using Alert Panels
Chapter 16. Localization
Chapter 17. Custom Views
Chapter 18. Images and Mouse Events
Chapter 19. Keyboard Events
Chapter 20. Drawing Text with Attributes
Chapter 21. Pasteboards and Nil-Targeted Actions
Chapter 22. Categories
Chapter 23. Drag-and-Drop
Chapter 24. NSTimer
Chapter 25. Sheets
Chapter 26. Creating NSFormatters
Chapter 27. Printing
Chapter 28. Web Service
Chapter 29. View Swapping
Chapter 30. Core Data Relationships
Chapter 31. Garbage Collection
Chapter 32. Core Animation
Chapter 33. A Simple Cocoa/OpenGL Application
Chapter 34. NSTask
Chapter 35. The End
In the next section of this review, I’ll provide some insight as to the code examples included in the book.