# Incremental Construction for Scalable Component-Based Systems
## 3 Component-Based Incremental Construction Process
In Figure 4(b), we consider component \(A\) with two provided services \(S_{1}\) and \(S_{2}\) (with specific message sequences) and two required services (\(S_{3}\) and \(S_{4}\)). As shown, service \(S_{1}\) has dependency upon two external services \(S_{3}\) and \(S_{4}\) whereas service \(S_{2}\) is independent of any external dependency. In a system, assuming that a provided port can be connected to more than one required port and a required port can be connected to one provided port, all provided and unconnected required component ports are ports of the system. A system by composing components \(A\) (initial system) and  
Figure 4: Incremental construction process. Figure 5: (a) Component definition, (b) Component behaviour, and (c) System behavior. \(D\) (an increment with one provided service \(S_{S}\)) is shown in Figure 5c. The system's functionality is a set of three provided services (\(S_{1}\), \(S_{2}\) and \(S_{5}\)); services on system ports (shown as \(B_{S}^{\prime}\)) or on system's components' ports (shown as \(B_{S}\)). The incremented system contains the behavior of the current system in two ways: (i) original services (e.g., \(S_{2}\) of \(A\)) of the current system are exhibited by the new system and (ii) the incremented system offers new services (e.g., \(S_{1}\) in Figure 5c) by combining services of the current system (e.g., \(S_{1}\) of \(A\)) and of the increment (e.g., \(S_{5}\) of \(D\)). The containment relationship between the two behaviors is expressed as '\(B_{A}\subseteq B_{S}\)'. In incremental construction, one advantage of this containment is that test cases of a current system \(S_{i}\) can be useful for testing the incremented system \(S_{i+1}\). Out of many demanded features required for the construction of CPS, in this paper, we focus on achieving the feature of scalability by using our defined incremental construction approach. In this era of technology, an IoT-based CPS is constructed from a big set of requirements in steps. In a system construction method, with a support of reuseability in the construction step, smaller units are composed or constructed to make bigger units. The outcome of each such step should be a defined type for further reuse without losing the existing features of the composed units. In other terms, the composition is algebraic; this means the system construction can be achieved recursively. The incremental way of constructing systems would help us to construct systems of systems. IoT-based systems and cloud-based systems are two such examples of bigger systems constructed by composing existing conventional physical systems in order to work together. Keeping in view the complexity of these bigger systems, after each incremental step the outcome can be tested by using certain test cases. As no functionality is removed, test cases of previous partial systems can also be executed on the later partial and final systems; hence, the one direct benefit of our incremental construction process is the ability to automate the automatic testing of the intermediate as well as the final system. This feature of automatic testing is out of scope of this paper. In truly CBD-based approaches, system construction is a bottom-up process, i.e., starting system construction from pre-built system-independent components [35; 36]. For this study, we assume all components with functionality are available for system construction. In the rest of the paper, the behavior containment of the current system in the incremented system is investigated at the service level which can also be investigated at the messages level if necessary. In order to study the construction process in the three categories of component models, we consider a simple calculator example that evaluates a mathematical expression (\(c=a^{2}+b^{3}\); where a, b and c are numeric variables). For the example in the study, we assume that each computational function is a provided service of a component (which may be calling other services in its code).