|
|
|

|
Hierarchies and Diagrams
|
|
Classes in a dictionary can be understood as arranged in two hierarchies. To see them, choose Dictionary > Show Diagram (or click Show diagram in the dictionary window’s toolbar). The button at the top of the diagram drawer lets you choose between hierarchies — the containment hierarchy or the inheritance hierarchy.
The containment hierarchy reflects the fact that an object has attributes (properties and elements), and an attribute can be another object. Thus, in theory, it should be possible to start at the “top” of the hierarchy (which is usually the single instance of the application class) and describe the relationships between classes as a tree. This tree is sometimes referred to as the application’s object model. The containment hierarchy expresses a “has-a” relationship among classes.
The inheritance hierarchy is an artifice originally introduced as a way of making dictionaries shorter. For example, in the Finder, folder and disk are two different classes, but they have many properties and elements in common. For instance, they both have an entire contents property saying what’s in them, and they can both have folder elements and file elements reflecting the hierarchy of items on disk. Thus it saves space, and makes conceptual sense as well, to separate out the entire contents property and the folder elements and file elements, along with all the other attributes shared by folders and disks, and express them as a separate class (here called container). The folder class and the disk class are then said to inherit from the container class, so that they share these properties and elements by virtue of this inheritance. The inheritance hierarchy expresses an “is-a” relationship among classes.
Script Debugger’s dictionary display can flatten the display of inherited attributes in the info pane. Click here to read more about this feature.
The above illustration (showing BBEdit’s containment hierarchy) is typical of what you’ll see in the diagram drawer. You can do three things here:
- Click any class’s name in the diagram to see the information for that class displayed in the info pane. Thus, the diagram drawer is an additional way to navigate the dictionary.
- Click the + or - button at the right end of any class’s name, to expand or collapse the hierarchy shown in the diagram from that point.
- Choose from the popup menu at the bottom of the drawer, to change the root of the diagram. Here, the application class is the root of the diagram, but you can change this to any class that has attributes. This is convenient as a way of “hoisting” part of the diagram, and is also valuable in the case of defective dictionaries, where the object model is faulty and fails to form a single coherent hierarchy.
Explore | Edit |
Run & Debug | Deploy | What's New In 4.5 |
My SD Story
|