Script Debugger can portray the classes in a dictionary as arranged in two hierarchies — the containment hierarchy and the inheritance hierarchy. Choose Dictionary > Show Object Model (or click Object Model in the dictionary window’s toolbar).
To toggle between the two hierarchies, choose Dictionary > Show Containment (or click Contains) or Dictionary > Show Inheritance (or click Inherits).
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 smaller. 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 encapsulate these and all 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 Safari’s containment hierarchy) is typical of what you’ll see in the object model diagram.
Here are some clues about how the object model diagram works:
Click any term in the diagram to see the information for that term displayed in the info pane. Thus, the diagram is an additional way to navigate the dictionary.
Note: There’s no separate dictionary entry for a property name, so when you select a property name in the diagram, the info pane shows the info for that property’s class — and that class is also automatically selected in the diagram.
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.
In the containment hierarchy, tick-marks indicate a one-to-one relationship (a property) or a one-to-many relationship (an element).
In the containment hierarchy, double-click a term in the diagram to dive into the hierarchy (the term is hoisted to the top of the hierarchy display). The path widget at the top left of the diagram shows you your place in the hierarchy and lets you navigate back up the hierarchy.
Some dictionaries have multiple separate inheritance hierarchies. In that case, buttons at the top left of the diagram let you switch between them.
Click here for the meaning of the icons to the left of the attribute names.