A Software Engineering Approach for Designing Maintainable Python-Based IoT Applications

Authors

  • David Naista Indonesia Universitas Islam Negeri Raden Intan Lampung image/svg+xml Author
  • Iqbal May Aryanto Indonesia Politeknik Negeri Lampung Author
  • Wahyu Hidayat Indonesia Universitas Islam Negeri Raden Intan Lampung image/svg+xml Author

Keywords:

Internet of Things, Python, Software Architecture, Software Engineering, Software Maintainability, Change Impact Analysis

Abstract

Python is increasingly used to build Internet of Things (IoT) applications on gateway-class devices, yet such applications are often written as monolithic scripts in which sensor access, control logic, and communication are intertwined, which makes them difficult to evolve. This study proposed and evaluated a software engineering approach for designing maintainable Python-based IoT applications. The approach combines a layered ports-and-adapters architecture, structural interfaces declared with typing.Protocol, a composition root with dependency injection, externalized typed configuration, and test doubles at the port boundary. It was evaluated in a controlled comparative case study in which a greenhouse monitoring node was implemented both as a conventional script and with the proposed approach, and both versions underwent four change scenarios: sensor replacement, protocol migration, a new control rule, and offline buffering. The proposed design reduced the mean cyclomatic complexity per function from 9.33 to 1.81 and kept the complexity of the control-loop unit constant at 5, whereas in the baseline it rose from 23 to 31. Across the scenarios, 75% of the changed lines fell in new modules or units compared with 3% in the baseline, no domain or application unit was modified, and no existing test failed, whereas the baseline failed 27 of 52 regression test executions. The costs were 59% more changed lines, 10.8 µs of additional latency per control cycle, and about 2 MiB of additional memory. The results indicate that explicit architectural boundaries make Python IoT software substantially easier to modify and test at a modest resource cost.

References

[1] M. Fahmideh, A. Ahmad, A. Behnaz, J. Grundy, and W. Susilo, “Software engineering for Internet of Things: The practitioners’ perspective,” IEEE Trans. Softw. Eng., vol. 48, no. 8, pp. 2857–2878, Aug. 2022, doi: 10.1109/TSE.2021.3070692.

[2] X. Larrucea, A. Combelles, J. Favaro, and K. Taneja, “Software engineering for the Internet of Things,” IEEE Softw., vol. 34, no. 1, pp. 24–28, 2017.

[3] N. Khezemi, S. Ejaz, N. Moha, and Y.-G. Guéhéneuc, “Comparison of code quality and best practices in IoT and non-IoT software,” 2024, arXiv:2408.02614.

[4] M. Klima et al., “Selected code-quality characteristics and metrics for Internet of Things systems,” IEEE Access, vol. 10, pp. 46144–46161, 2022.

[5] N. Rios, R. O. Spínola, and G. H. Travassos, “Exploring technical debt on IoT software projects,” in Proc. 21st Brazilian Symp. Softw. Quality (SBQS), Curitiba, Brazil, 2022, pp. 88–97.

[6] F. Arcelli Fontana and I. Pigazzini, “Evaluating the architectural debt of IoT projects,” in Proc. IEEE/ACM 3rd Int. Workshop Softw. Eng. Res. Practices IoT (SERP4IoT), 2021, pp. 27–31, doi: 10.1109/SERP4IoT52556.2021.00011.

[7] I. Plauska, A. Liutkevičius, and A. Janavičiūtė, “Performance evaluation of C/C++, MicroPython, Rust and TinyGo programming languages on ESP32 microcontroller,” Electronics, vol. 12, no. 1, Art. no. 143, 2023, doi: 10.3390/electronics12010143.

[8] A. Liu, J. Lefever, Y. Han, and Y. Cai, “Prevalence and severity of design anti-patterns in open source programs—A large-scale study,” Inf. Softw. Technol., vol. 170, Art. no. 107429, Jun. 2024.

[9] X. Xia, Y. Yan, X. He, D. Wu, L. Xu, and B. Xu, “An empirical study on the impact of Python dynamic typing on the project maintenance,” Int. J. Softw. Eng. Knowl. Eng., vol. 32, no. 5, pp. 745–768, 2022.

[10] L. Di Grazia and M. Pradel, “The evolution of type annotations in Python: An empirical study,” in Proc. 30th ACM Joint Eur. Softw. Eng. Conf. Symp. Found. Softw. Eng. (ESEC/FSE), Singapore, 2022, pp. 209–220.

[11] N. Khezemi, J. B. Minani, F. Sabir, N. Moha, Y.-G. Guéhéneuc, and G. El-Boussaidi, “A systematic literature review of IoT system architectural styles and their quality requirements,” IEEE Internet Things J., vol. 11, no. 23, pp. 37599–37616, Dec. 2024.

[12] D. Naista and G. J. H. Aziz, “Model arsitektur perangkat lunak microservices dengan API gateway untuk manajemen perangkat IoT terdistribusi pada smart campus,” INDUCTOR: J. Electron. Comput. Technol. Innov., vol. 1, no. 2, pp. 8–18, Jul. 2026, doi: 10.25181/inductor.v1i2.5024.

[13] R. C. Martin, Clean Architecture: A Craftsman’s Guide to Software Structure and Design. Boston, MA, USA: Prentice Hall, 2017.

[14] D. Naista, G. J. H. Aziz, and Wahyu Hidayat, “Design and development of a web-based virtual programming laboratory for information systems education,” CHAIN: J. Comput. Technol., Comput. Eng., Informatics, vol. 4, no. 3, pp. 251–269, Jul. 2026, doi: 10.58602/chain.v4i3.294.

[15] J. B. Minani, F. Sabir, N. Moha, and Y.-G. Guéhéneuc, “A systematic review of IoT systems testing: Objectives, approaches, tools, and challenges,” IEEE Trans. Softw. Eng., vol. 50, no. 4, pp. 785–815, Apr. 2024, doi: 10.1109/TSE.2024.3363611.

[16] J. B. Minani, F. Sabir, N. Moha, and Y.-G. Guéhéneuc, “A multimethod study of Internet of Things systems testing in industry,” IEEE Internet Things J., vol. 11, no. 1, pp. 1662–1684, Jan. 2024.

[17] J. B. Minani et al., “IoT systems testing: Taxonomy, empirical findings, and recommendations,” J. Syst. Softw., vol. 226, Art. no. 112408, 2025.

[18] F. Ihirwe, D. Di Ruscio, S. Gianfranceschi, and A. Pierantonio, “Assessing the quality of low-code and model-driven engineering platforms for engineering IoT systems,” in Proc. IEEE 22nd Int. Conf. Softw. Quality, Rel. Secur. (QRS), 2022, pp. 583–594.

[19] Systems and Software Engineering—Systems and Software Quality Requirements and Evaluation (SQuaRE)—Product Quality Model, ISO/IEC 25010:2023, 2023.

[20] T. J. McCabe, “A complexity measure,” IEEE Trans. Softw. Eng., vol. SE-2, no. 4, pp. 308–320, Dec. 1976.

[21] D. Coleman, D. Ash, B. Lowther, and P. Oman, “Using metrics to evaluate software system maintainability,” Computer, vol. 27, no. 8, pp. 44–49, Aug. 1994.

[22] M. Lacchia, “Introduction to code metrics,” Radon 6.0.1 Documentation. [Online]. Available: https://radon.readthedocs.io/en/latest/intro.html (accessed Sep. 25, 2026).

📊 Abstract views: 23 📝Downloads: 12

Downloads

Published

2026-09-30

Similar Articles

You may also start an advanced similarity search for this article.