18.2. Visibility

In common usage, visibility is the ability of an object to “see” or have a reference to another object. More generally, it is related to the issue of scope: Is one resource (such as an instance) within the scope of another? There are four common ways that visibility can be achieved from object A to object B:

  • Attribute visibility— B is an attribute of A.

  • Parameter visibility— B is a parameter of a method of A.

  • Local visibility— B is a (non-parameter) local object in a method of A.

  • Global visibility— B is in some way globally visible.

The motivation to consider visibility is this:

For an object A to send a message to an object B, B must be visible to A.

For example, to create an interaction diagram in which a message is sent ...

Get Applying UML and Patterns: An Introduction to Object-Oriented Analysis and Design and the Unified Process, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.