## 1 Introduction
Among those attacks, packet-dropping attacks (i.e., packet loss) are one of the most disruptive and devastating threats in WSNs [21]. Packet-dropping attack drops the received data packets or control messages instead of forwarding them to other nodes, disrupting the normal operation of the network. Security attacks need to be conveniently addressed by detecting and preventing such malicious behaviors. WSN security has drawn the attention of many researchers [7; 9; 10; 11]. To address and overcome the security issue which is considered one of the main challenges in WSNs, many security solutions were developed including software-based network Intrusion Detection Systems (IDSs) [3; 6; 9; 12]. IDSs are classified according to different properties [9; 16]. Therefore, these systems are deployed on different applications and environments. Accordingly, they have different SE requirements, designs, architectures, and implementation methods [1; 2; 3; 4; 22; 23]. Consequently, developing a secure IDS while considering the energy resource is important. However, from [9; 22], it can be seen that not all IDSs fulfill this aspect. Moreover, the development of such systems is unstructured and does not deploy the software engineering processes; therefore, this research was conducted. Many IDSs were developed, but not with the best designs that provides the best performances [9; 21; 24; 25]. Building efficient IDSs for WSN is significant to ensure its secureness against different types of security attacks threatening its services. As part of the development of these IDSs is purely software-based, a clear software development life cycle (SDLC) should be identified and followed. This paper addressed the absence of following SDLC throughout the development of IDS for WSN. Moreover, this research studied the integration of software engineering process in the development of IDSs and how this affects the performance of WSN services. Therefore, this research developed an enhanced version of a hierarchical energy efficient IDS that was proposed by the authors in [21]. The development of the enhanced IDS has followed the SDLC phases. This study has focused mainly on the Requirement Engineering, Software Design, and Testing processes. One of the main thrusts of this research is to follow the SDLC phases in the development of the IDS and to show how this affects the overall performance of the IDS. In addition, three software designs were developed, tested, and compared in order to show the importance and the effect of different software designs. Such IDS development practice will contribute to the fields of SE as well as WSNs. Moreover, this study illustrated the most common mistakes that have been practiced when developing IDSs in relation to requirement engineering. As for the software testing, this paper discusses how the testing was carried out and based on what criteria and metrics the performance was measured. Additionally, the inconsistency in the adaptation of the performance measurements that have been used by various authors and researchers was also discussed, as there is no standardization or a common list of measures in the field of WSN. Moreover, after developing the IDS, it was tested and the test results of the enhanced IDS with the previous IDS were compared and then analyzed. The results revealed an increase in the network lifetime and reduction in the consumed energy when proper designs were implemented, although the IDS approach was not changed. This ensures the importance of following suitable SDLC while developing IDS for WSNs. Apart from this introduction, the rest of the paper is structured into seven sections: Section 2 discusses the related work and highlights the innovativeness of this research, and Section 3 presents this research methodology and components. Section 4 discusses the proposed work including deep analysis of the current IDSs from SE perspectives and proposing an integration of SE process to the development of IDSs in WSN to enhance their performances.