Monthly Archives: April 2010

Chapter 10: Accessors

Accessors are the methods used to set and examine the instance variables of a class. The standard naming convention in Cocoa is to use the name of the variable as the getter (or accessor) and the variable name prefixed with … Continue reading

Posted in Uncategorized | Leave a comment

Chapter 9: Perform Selector and Delayed Perform

I’ve come across selectors several times in the sample programs I’ve studied, and even used them occasionally when writing my own code, mostly for messages sent so my code can act as a delegate for printing and saving. For my … Continue reading

Posted in Uncategorized | Leave a comment

Chapter 8: Enumerators

I enjoyed learning about enumerators when going through Head First Design Pattterns, and I think I understand them reasonably well. However, Cocoa has an abstract NSEnumerator class that can be used in a traditional loop like id instance NSEnumerator *enum … Continue reading

Posted in Debugging hints | Tagged , | Leave a comment

Chapter 7: Anonymous Type and Heterogeneous Containers

The anonymous type is our old standby, the id. The Cocoa type id indicates a generic pointer, which can point to any kind of object. In C++, every pointer to an object must have a defined type, and assigning a … Continue reading

Posted in Uncategorized | Leave a comment

Chapter 6: Category

Cocoa allows developers to declare a category that adds methods to an exisiting class. The category pattern lets you extend existing classes, even if you don’t have access to the source code, implement different methods of the same class in … Continue reading

Posted in Debugging hints | Tagged , | Leave a comment

Chapter 5: Dynamic Creation

I enjoyed this chapter because of the example, an command-line RPN (Reverse Polish Notation) calculator. I still make regular use of my RPN-based HP-12C calculator, and it was cool to see how easy it was to implement a command-line RPN … Continue reading

Posted in Uncategorized | Leave a comment

Chapter 4: Template Method

Head First Design Patterns puts the template method in a chapter titled Encapsulating Algorithms. The idea is that if you have a group of similar classes that tend to perform the same steps in the same order, you can abstract … Continue reading

Posted in Uncategorized | Tagged , | 1 Comment