Cocoa

Mike Ash does a bang up job answering this question:

There are two NSObjects in Cocoa, a class and a protocol. Why both? What purpose do they serve?

Mike briefly covers namespaces, root classes, proxies and protocols.

Graham Lee on the history of Cocoa:

First there came message-passing object oriented programming, in the form of Smalltalk. Well, not first, I mean first there was Simula 67, and there were even things before that but every story has to start somewhere. In 1983 Brad Cox added Smalltalk messaging to the C language to create the Object-Oriented pre-compiler. In his work with Tom Love at Productivity Products International, this eventually became Objective-C.

Graham goes on to provide information on a series of books, all leading to what we now know as Cocoa.

Happy Birthday Cocoa.

What follows is a quick introduction to working with protocols. This is good background information to understand as protocols are common in various Cocoa frameworks. A protocol is means to define a list of required and/or optional methods that a class implements. If a class adopts a protocol, it must implement all required methods in the protocols it adopts.

Cocoa uses protocols to support interprocess communication through Objective-C messages. In addition, since Objective-C does not support multiple inheritance, you can achieve similar functionality with protocols, as a class can adopt more than one protocol.
Read more »

What follows is a brief guide to working with Notifications in Cocoa. I’ll cover the basics, including registering an observer and posting notifications, just enough to start using notifications in your apps.

There is an instance of NSNotificationCenter available to every running application. This class acts as an intermediary to facilitate communication between objects that are interested in being notified at some point in the future (these objects are known as the observers) and a poster that posts to the notification center, resulting in all observers (registered for a specific notification) being called.
Read more »

While working on an iPhone application recently, I needed to convert a date read from an XML stream that was in the following format: 20081122 to a nicely formatted string for display on the device: Saturday November 22, 2008.
Read more »

In the first post on working with dates several of the examples use the “old style” date format syntax. The examples work, however, I want to show an additional example that uses the ICU (International Components for Unicode) library for format strings.
Read more »

Sometimes all you’re really looking for is a basic chunk of code to get something done. For example, I was working on an application yesterday and needed to display the current date in text format: October 29, 2008. A simple concept for sure, however, with the many nuances of date formatters, it takes some time to pull together the “right” code.
Read more »

The Minnesota CocoaHeads met tonight and it was an interesting spin on development for the Mac. Troy Gaul did a presentation on Adobe Lightroom, from the perspective of the development tools and approach used to create Lightroom.

Although I have heard of Lua , I had no idea of the depth of its usefulness. It was impressive to see the extent it’s used in Lightroom, somewhere in the neighborhood of 60% of the code base. Read more »

In the previous post (on the iPhone Developer Tips blog) I demonstrated a simple debug class that I wrote to wrap some additional code around NSLog. The code allows for displaying additional information beyond the date/time stamp and process ID that NSLog outputs, specifically, the filename which calls the debug routine, and the line number where the call was invoked. I also added a few additional configuration options including an option to disable all debug messages.

You can read the rest of the tip on the iPhone Developer Tips blog.