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

16. Hierarchies

In Cocoa, hierarchical nesting is often used to organize objects. A hierarchy of view objects is used to organize and control drawing and coordinate systems in Cocoa. The Responder Chain pattern, described in depth in Chapter 18, “Responder Chain,” leverages the view hierarchy. Hierarchies are also seen in many data models and parse trees given that most are hierarchical in nature.

Hierarchies define relationships between objects to avoid ambiguity about which objects are responsible for storage of other objects. In addition, hierarchies provide an alternative to subclassing. In Cocoa, hierarchies are used when objects have a “has-a” relationship, while subclassing is used only for a true “is-a” relationship. Hierarchies in Cocoa ...

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