6.3 Networks of objects
No serious program consists of a single object. Instead there will be a network of objects, which collaborate to achieve the functionality of the whole system. Figure 4 shows a network of objects representing a hotel, some guests and some rooms. This sort of diagram is called an object diagram or a snapshot diagram. It shows one particular possible configuration of the system. This particular diagram shows the state of the system when it contains a single hotel, two guests and two rooms. The guest with name ‘Jack’ is linked to the room with name ‘blue suite’, and the guest with name ‘Jill’ is linked to the room with name ‘r234’.
The notation used in Figure 4 is the UML notation for object diagrams. Each box represents an object and the data it encapsulates, and that objects can be linked to other objects.
A link is a connection between two objects that is significant for the application area. To establish a connection between two objects we need to identify, and distinguish between, each object. An identity is an unchanging property of an object that distinguishes it from all other objects. Software distinguishes between objects using an internal identity that is intelligible only to the software system; objects are not distinguished by the data they store.
How people distinguish between real-world objects is different from how software distinguishes between objects which may represent those real-world objects. People distinguish between real-world objects using identifiers with values that are understood by other people, e.g. a property such as a person's name. This conflict of identities has to be resolved by the interface between a system and its users.