Monthly Archives: December 2008

Patterns in Objective-C: Strategy Pattern using Forwarding

When working with the Observer Pattern and the Singleton Pattern it is easy to see how they relate to the Java or C++ versions of the same concept. Everything basically plugs into the same places you would expect, coming from … Continue reading

Posted in Uncategorized | Leave a comment

Variable Arguments (varargs) in Objective-C

Creating variable argument functions (also vararg or variadic function) in Objective-C is done the same way that it is done in C, using the stdarg.h library. For those of us working in Cocoa, Apple has already included the import in … Continue reading

Posted in Uncategorized | Leave a comment

Importing a Framework

Commonly when working with the iPhone SDK we run into a situation where the specific library we need is in a precompiled framework. These frameworks are libraries: collections of functionality thrown together into one package. Using a framework is easy: … Continue reading

Posted in Uncategorized | Leave a comment

Patterns in Objective-C: Observer Pattern

One of the most common patterns, after the Singleton, in Java is the Observer Pattern. Also referred to as a Broadcaster/Listener or a Publish/Subscribe pattern. The basic principle is that there are two components: An Observer (or Listener) and a … Continue reading

Posted in Uncategorized | 1 Comment

Static Constant Strings in Objective-C

One of the most commonly used features in Java is the ability to avoid string “magic constants” by putting those strings into static variables. These values are then readily accessible inside of the class, not necessarily visible outside of it, … Continue reading

Posted in Uncategorized | 1 Comment

Patterns in Objective-C: Singleton Pattern

One of the challenges in switching to a new language is figuring out how design patterns adapt.   Sometimes the language has built-in facilities for the pattern, or features that work-around what the pattern was designed to do in the first … Continue reading

Posted in Uncategorized | Leave a comment