# Incremental Construction for Scalable Component-Based Systems
## 4 Incremental Construction in CBD
### Architecture Description Languages
#### 4.2.1 The Basic Pipe-And-Filter Component Model  
In CBD, for pipe-and-filter architectural style [41], a filter is an independent component with one or more input/output data ports; filter components read data from input ports, transform data and write data to the output ports. A pipe transfers data from the sender to the receiver ports. Pipe-and-filter architecture is formally defined in [43] and the ProSave component model (in the ProCom component model [45]) is based on a pipe-and-filter paradigm [44].  
In the basic pipe-and-filter component model (basic-pnf), a component is an AU with many in-/out-ports (Figure 13a). A component with at least one in-port/out-port is an eligible filter component in basic-pnf. Ports in filter components are channels for data communication. A data type is associated with each port that represents the type of data allowed to be communicated through the port. The behavior of a filter component is a set of functions and a function is a relation between a non-empty sub-set of in-ports and one out-port (Figure 13b shows the functionality of a specific component _K_). In order to keep the model simple, we assume that an in-port is related to one out-port. The functionality of a component can also be represented as a set of out-ports; where an out-port is simply a function of in-ports, as shown in Figure 13c for \(K\). Figure 13c shows the execution semantics of a function of a component. In run-time, as soon as the data is available on in-ports, the related function is evaluated in three steps: (i) read in-ports atomically, (ii) compute the computation and (iii) write data on an out-port. Ports are read-destruct, which means that the data on ports will be destroyed once read.  
In a basic-pnf, filter components are composed by port connections (referred to as a pipe to transfer between ports) between two non-similar (one in-port and one out-port) ports by matching the associated data types. The port of a filter component can be connected to one pipe. Composing two or more filters with pipes produces a composite filter (Figure 13d). All unconnected ports are the ports of the composite. In Figure 13d, initial system \(S_{0}\) (component _A_) is incremented by connecting \(inc_{0}\) (component _C_) through a pipe to create system \(S_{1}\) (the composite _AC_). Function f5 (a compound function f1 of \(S_{0}\) and f3 of \(inc_{0}\)) of \(AC\) relates the composite's out-port 'h' with the composite's in-port 'a'. Corresponding with the definition of incremental construction from Section 3, f5 contains f1; hence, the relation of behavior containment between the two systems holds (\(B_{A}\subseteq B_{AC}\)). The basic-pnf component model supports incremental construction.  
In order to illustrate incremental construction in basic-pnf, we use Modelica [46] to construct the system to evaluate a mathematical expression (\(c=a^{2}+b^{3}\); where a, b and c are numeric variables). We develop three filter components (with one function each): (i) _calc_ to add two integer values, (ii) _sCom_ to square an integer value and (iii) _cCom_ to cube an integer value. The system is constructed in two steps, as shown in Figure 14.  
Figure 13: (**a**) A filter component, (**b**) Port relations, (**c**) Execution semantics, and (**d**) a composite.