Avoiding Bad Programming Practices in Education and Profession — Initial Considerations

Uloženo v:
Podrobná bibliografie
Název: Avoiding Bad Programming Practices in Education and Profession — Initial Considerations
Autoři: Mikac, Matija
Zdroj: Acta Polytechnica Hungarica. 22(12):215-246
Informace o vydavateli: 2025.
Rok vydání: 2025
Témata: bad programming practices, computer programming, program code readability, program form deficiencies, program formal and functional correctness, influence on performance
Popis: In contemporary computer programming and various presentations thereof in all sorts of media, one can witness the emergence of several bad programming practices such as undermining the abstractness and generality of programs, poor commenting and input/output messaging, bad identifiers, brute-force computations that ignore closed-form results from elementary mathematics, indolence toward computational optimality, and many more. Several of those are also found in the programs produced by the GenAI (Generative Artificial Intelligence) tools, such as the freely available ChatGPT that we used here for comparison. We analyze those bad practices and discuss how to avoid and correct them by providing parallel exemplary programs, which are based on the best algorithms and implemented in C/C++ in a textbook, scholarly way. Drawbacks of bad program code range from hard readability and reusability to significantly and even drastically lower efficiency. This last, very degrading downside of bad programming is shown by measuring the execution times of inferiorly conceived and realized C/C++ functions for a few common programming examples, and by comparing them to the corresponding well-written functions with proper algorithms. The main reasons for bad programming habits and inferior source code quality are low prerequisite knowledge and skills, a weak foundation in mathematics and computer science, and a lack of intellectual and working discipline in both teachers and learners of computer programming. With more and more bad source code examples available on the Web, the future AI-generated programs could comprise considerable amounts of programming code of bad quality and low efficiency, or even code that gives incomplete or wrong results. This will happen unless the AI tools' input sources are supervised by expert.
Druh dokumentu: Article
ISSN: 1785-8860
DOI: 10.12700/aph.22.12.2025.12.15
Přístupové číslo: edsair.dris...01492..b09932cd033253e7bbfc67915c33a788
Databáze: OpenAIRE
Popis
Abstrakt:In contemporary computer programming and various presentations thereof in all sorts of media, one can witness the emergence of several bad programming practices such as undermining the abstractness and generality of programs, poor commenting and input/output messaging, bad identifiers, brute-force computations that ignore closed-form results from elementary mathematics, indolence toward computational optimality, and many more. Several of those are also found in the programs produced by the GenAI (Generative Artificial Intelligence) tools, such as the freely available ChatGPT that we used here for comparison. We analyze those bad practices and discuss how to avoid and correct them by providing parallel exemplary programs, which are based on the best algorithms and implemented in C/C++ in a textbook, scholarly way. Drawbacks of bad program code range from hard readability and reusability to significantly and even drastically lower efficiency. This last, very degrading downside of bad programming is shown by measuring the execution times of inferiorly conceived and realized C/C++ functions for a few common programming examples, and by comparing them to the corresponding well-written functions with proper algorithms. The main reasons for bad programming habits and inferior source code quality are low prerequisite knowledge and skills, a weak foundation in mathematics and computer science, and a lack of intellectual and working discipline in both teachers and learners of computer programming. With more and more bad source code examples available on the Web, the future AI-generated programs could comprise considerable amounts of programming code of bad quality and low efficiency, or even code that gives incomplete or wrong results. This will happen unless the AI tools' input sources are supervised by expert.
ISSN:17858860
DOI:10.12700/aph.22.12.2025.12.15