Penerapan Shannon Entropy untuk Evaluasi Kualitas Kode Program
Keywords:
Entropy Shannon; kualitas kode; penerapan; program; Tokenisasi;Abstract
Program code quality is an essential aspect of software development because it affects the system's readability, maintainability, and sustainability. Code quality evaluation is generally carried out using conventional metrics such as Lines of Code and Cyclomatic Complexity. Still, these metrics are not fully able to capture the regularity of the code structure. This study aims to apply Shannon Entropy as a quantitative indicator in evaluating program code quality. The study uses a quantitative approach with a case study of one software application comprising five source code files. The analysis is carried out through a code tokenization process to obtain the token distribution, followed by the calculation of token probabilities and Shannon Entropy values based on information theory. The results show that the entropy values in each file vary. The file with the highest number of tokens (6,098) produces the highest entropy value of 9.9427, while the file with the lowest number of tokens (435) has the lowest entropy value of 7.3243. Other files show entropy values of 8.1743, 7.6099, and 7.8465. The variation in entropy values reflects the differences in the level of regularity and complexity of the code structure in each file. The research findings show that Shannon Entropy can be used as a complementary metric to evaluate the quality of program code and can quantitatively distinguish the level of regularity in code structure.
Keywords: Entropy Shannon; kualitas kode; penerapan; program; Tokenisasi;
References
T. Nazaré, J. Gadelha, E. Nepomuceno, and R. Lozi, “Green Computing for Energy Transition: A Survey,” IEEE Lat. Am. Trans., vol. 21, no. 9, pp. 937–948, 2023, doi: 10.1109/tla.2023.10251799.
G. Ruhe, “Optimization in Software Engineering: A Pragmatic Approach,” Contemp. Empir. Methods Softw. Eng., pp. 235–261, 2020, doi: 10.1007/978-3-030-32489-6_9.
J. Penerapan, T. Informasi, D. Suatu, and A. Berbasis, “ANALISIS QUALITY CODE MENGGUNAKAN SONARQUBE DALAM SUATU APLIKASI BERBASIS LARAVEL,” vol. 02, pp. 89–103, 2023.
R. Sehgal, D. Mehrotra, R. Nagpal, and R. Sharma, “Green software: Refactoring approach,” J. King Saud Univ. - Comput. Inf. Sci., vol. 34, no. 7, pp. 4635–4643, 2022, doi: 10.1016/j.jksuci.2020.10.022.
M. Andryan, W. Saputra, W. A. Rioditama, and H. Setyowati, “Survei Teknik-Teknik Pengukuran Kualitas Perangkat Lunak,” vol. 3, no. 1, pp. 2715–2731, 2021.
S. Nazir, N. Fatima, S. Chuprat, H. Sarkan, F. Nurulhuda, and N. N. A. Sjarif, “Sustainable Software Engineering : A Perspective of Individual Sustainability,” vol. 10, no. 2, pp. 676–683, 2020.
Z. Zheng, “Shannon Theory BT - Modern Cryptography Volume 1: A Classical Introduction to Informational and Mathematical Principle,” Z. Zheng, Ed. Singapore: Springer Singapore, 2022, pp. 91–151.
S. Naeem, S. Anam, A. Ali, M. Zubair, and M. M. Ahmed, “A Brief History of Information Theory by Claude Shannon in Data Communication,” no. 13.
B. Gizela, D. Puspita, M. Inri, and S. Pamungkas, “Pengaruh Perkembangan Industri Terhadap Pola Penyebaran Lahan Terbangun di Kota Balikpapan Berbasis Analisis Shannon ’ s Entropy,” vol. 05, no. 01, pp. 26–32, 2025.
H. Farasat, M. Sayadi, and H. Y. Gachini, “Analysis of the Contents of the Science Textbooks of the First Elementary Period , based on the Amount Of Attention to Science Process Skills with Shannon Entropy Method هجوت نازیم ساسا رب ییادتبا لوا ةرود مولع یاه باتک یاوتحم لیلحت نوناش یپورتنآ شور اب یملع دنیارف یاه تراهم هب,” vol. 12, no. 1, pp. 667–689, 2023.
Downloads
Published
Issue
Section
License
Copyright (c) 2025 Jurnal Rekayasa Informatika

This work is licensed under a Creative Commons Attribution 4.0 International License.





