Sophtalk

Tools should be as independent of each other as possible so that you can remove or modify them without disturbing the rest of the environment. The most important factors contributing to a healthy independence among tools are simple and complete functional and communication interfaces. To promote design that accounts for communication, Centaur makes extensive use of Sophtalk networks (see the Sophtalk documentation in the Core). Sophtalk is a system for enabling tools to communicate according to an event model. In this model, tools send signals to one another when important events occur. For example, signals may testify that a state change has occured (e.g., the editors tree has been modified), that an error has occurred, that data is required to complete a computation, etc.

Tools communicate within a network. Each tool is encapsulated within the network by an stnode. Each stnode belongs to an stnode class that determines the input signals the stnode receives and the output signals it may send when it belongs to a network. A tool may be encapsulated several times in the same network or in different networks. Tools may reside in the same process or run as different processes on remote machines.

Each signal may carry any number of values. A signal is received by all stnodes in the network with an input port having the same name. The arrival of a signal at an stnode triggers an input callback function. This function's first two arguments are always the stnode itself and the name of the arriving signal. The callback must have same number of arguments after the stnode and signal name as the number of values carried by the signal. The callback may be defined to receive a list of values, however.

N.B. It is not always easy to determine what information should be memorized by an object and what information should be retrieved through network communication. For example, the source ctedit has no knowledge of the tools working on it. It should not be required to memorize these tools. It blissfully goes about its business while tools are being added or removed from the network. On the other hand, it is less obvious whether a tool working on the ctedit should memorize the ctedit in a structure or request information about the ctedit's root or selections through the network. In general, when an object requires information constantly from a known source, the object should memorize the source. If the source may be removed under the object's feet, or the source is unknown or many may reply, the tool should access information through network communication.



                  



Tutorial