State Persistence for Transport
Ivan Marsic • Rutgers University
260
Components can be composed into more complex, composite components, as in Figure 7-1c, where each operational amplifier within the chip could be a separate “component.” Composing
components is illustrated in Figure 7-4c, where component H contains component I. Notice that one of the output ports of component G connects to an input port of component H which is
directly connected to an input port of component I. Regular input port cannot be connected to another input port. Similar is true for output ports. To support forming chains of ports of the same
type, we introduce a prefix port sub-type, shown in Figure 7-4c.
Typical event communication and processing in a single-threaded system is illustrated in the sequence diagram in Figure 7-5. In this example, component A receives Event 1 on the input port
a 1, processes it and generates event 2 on the output port a2. This event is received and processed
by component B. The dashed lines at the bottom of the figure indicate how the thread returns after this sequential processing is completed.
All components and ports are named and addressable using a Unix-type path. For example, full path format for a port on a nested component is as:
〈container_component_name〉〈inner_component_name〉〈port_name〉
Component names are separated by forward slashes and the port name is preceded by “at” sign . Thus, the components and their ports form a tree structure.
Design Issues
It was debated whether to strictly enforce the Port model for communicating with Components. Currently, actions that require computation go via Ports. Conversely, access to state variables
component properties is via setPropertygetProperty methods. So, if component has a handlereference to another component which normally should not happen, it can invoke
these methods. Of course, the state access could also go over the Ports, but convenience was preferred over compliance. Further deliberation may be warranted to evaluate the merits and
hazards of the current solution.
A B
C A
B
C
a b
c
H I
G
Prefix ports
Composite component
H I
G
Prefix ports
Composite component
D E
F
Wire
D E
F
Wire
Figure 7-4. Options for wiring the ports. a Component ports can be directly “soldered” one-on-one. b The abstraction of wire provides a broadcast medium where the event from
any output connected to the wire appears on all input ports connected to the same wire. c Prefix ports are used in wiring composite components.
Chapter 7 • Software
Components 261
Another issue is, what if, in Figure 7-5, component A needs some return value from component B
? This could probably be achieved by connecting B’s output port to A’s another input port, but is this the most elegantefficient solution?