next up previous
Next: 3 Case Study: The Up: 2 Position Previous: 2.2 Connectors

2.3 Components

Components implement functions of the system assisted by access functions in the interfaces. The internal structure of a component is application dependent, and is hidden in the description. A component is expressed by a ML functor as sketched in the follows:


functor Component1  (Connector: Interface1) : 
sig  
val proc : $unit \rightarrow unit$;  
end  
=  
struct  
($\ast$ hidden internal structures  $\ast$)  
fun proc () = ...
end; 



functor Component2  (Connector: Interface2) : 
sig  
val proc : $unit \rightarrow unit$;  
end  
=  
struct  
...
end; 
The process proc created by the component can be executed both sequentially and in parallel according to the application. Connector is the formal name for a connector which connects Component to the interacting component through Interface. The number of the connectors in the parameter list of this functor is the number of inward stubs in its pattern, as shown in the following examples.

The specific components, C1 and C2 in Figure 1, are given by:

structure C1 = Component1($Con\_C1\_C2$);
structure C2 = Component2($Con\_C1\_C2$);
It is not difficult to derive the semantics of an Application module from the definitions of the connector and the component in terms of a ML functor:
functor Application (Connector: Interface) :
sig
val input : $unit \rightarrow Range$;
val output : $Domain \rightarrow unit$;
end
=
struct
($\ast$ implementation of the input and the output functions $\ast$)
end;
The introduction of the Application module makes the notation more expressive, as illustrated in the following section. In an object-oriented system [Booc86,GHJV95], it is often the case that an object uses another object in order to provide a new service.


next up previous
Next: 3 Case Study: The Up: 2 Position Previous: 2.2 Connectors

Hongyan Sun and Anders P. Ravn
Sept. 2, 1997