O'Reilly logo

Cocoa Design Patterns by Donald A. Yacktman, Erik M. Buck

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

19. Associative Storage

Associative Storage is one of the oldest and most used patterns in software development. It organizes data and keys so that data can be quickly and easily accessed using the corresponding keys. Associative Storage promotes flexibility and runtime storage efficiency.

Motivation

Use Associative Storage to accomplish the following:

• Efficiently store arbitrary data associated with objects.

• Promote flexibility by delaying the selection of which data to access until runtime.

• Provide object extensibility per instance instead of per class.

• Work around an Objective-C programming language limitation that prevents addition of instance variables without subclassing.

Solution

The NSDictionary and NSMutableDictionary classes ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required