## 4 IDS Analysis from Software Engineering Perspectives
### IDS Enhancements from an SE Perspective  
From the illustrated drawbacks and unclear requirements, we can see that the authors' solution was not well studied and it also did not cover all the requirements. Therefore, this study finds IDS in [21] a good case study to be examined in order to show the set of cases and requirements that have not been handled and the inefficiency of the system design due to not following the SE processes--moreover, since the authors have not defined clear requirements or system design to follow and, basically, they have left the readers with possibilities. Therefore, Section 4 presents a case study that shows the different designs that are suggested in this paper, with which the IDS could have been built upon. To illustrate the enhancements proposed by this study, the following were added to the selected IDS:  
* Add a new factor to the selection criteria of the SCH, which is the Received Signal Strength Indicator (RSSI). RSSI is defined as \"a measurement of the power present in a received radio signal\" [52]. Each node within the WSN has RSSI value. The radio signal strength decreases with distance [53], so it is a negative correlation between the signal strength and the distance. Therefore, from the RSSI value, we can determine the distance of the node. This factor has been added to guarantee that the chosen SCH node would be the closest node to the CH because our goal is to ensure that the SCH node can hear all in/out transmissions of the CH. * Change the monitoring and tracking process of the SCH, by deploying the Watchdog technique instead of letting the nodes contact the SCH. The Watchdog mechanism is one of the intrusion detection techniques used in WSNs [54]. Thus, it is a monitoring technique that monitors the nodes within its range (i.e., nearby nodes) [54; 55]. Once the Watchdog technique is adopted, only the CH and the BS know who are the SCHs and not all nodes. This will be discussed further in the next section. Moreover, to discuss how these enhancements improved the performance of this IDS, a theoretical analysis is provided in Table 2.  
Although IDSs are considered a type of software security solutions, IDSs' developers are not showing a visible software development process in their proposals. Thus, in order to implement these enhancements and develop an enhanced version of the discussed IDS, this research has started with the first and very important step, which is to select the correct and suitable SDLC model. The selection process depends on a set of factors called the selection factors, as mentioned in [56]. However, to fulfil the characteristics of developing an IDS, the factors in [56] are not enough. Therefore, according to the factors in [56] and the ones in [57; 58], a combination of factors have been created and then applied to the characteristics of developing an IDS [6; 9; 22]. Accordingly, it can be decided that the suitable model is the Spiral Model. The spiral model of a software process is broken down into four phases. By going through the model phases (Figure 5), it is shown how the development of the proposed IDS was accomplished. The details are illustrated below:  
(1) Phase One: Determine Objectives and Constraints  
The first stage is to identify and collect the system's objectives and requirements. It is the most important and critical stage of the development process [56; 57] because any requirement that is not resolved at this stage will be carried out through the rest of the SDLC. Therefore, requirements have been gathered and analyzed from the beginning to cover all requirements in the IDS hierarchy layers, with regard to resources constraints. Firstly, in reference to the categories defined in [6; 59; 60], the general and main requirements are listed in Table 3.  
(2) Phase Two: Identify Risks and Evaluate Alternatives  
The second stage is to identify the alternatives and risks and evaluate them. Risks are definite in IDSs; therefore, the risks associated with the enhanced IDS and their effects are illustrated in Table 4.