Readability of code produced by generative artificial intelligence models: Across different programming paradigms
2024 (English)Independent thesis Basic level (university diploma), 10 credits / 15 HE credits
Student thesis
Abstract [en]
When developing software, there are many different approaches. The process of developing software can mean that the developer has specific design sessions. On the other hand, designing software can also be a rather unplanned process. A third, newly possible, option could be to simply leave it up to artificial intelligence to either design software or to generate the code entirely.
Regardless of how the software is designed, the code will most likely have to be read by another developer at some point, even when the code is generated by AI. This is where the importance of readability in code comes into place. Readable software enables maintainability and development to name a few attributes.
The previously mentioned option to incorporate AI can be a useful method, but only if the code itself is readable. One aim of the current study was therefore to examine the readability in AI generated code. Furthermore, there are a number of different programming paradigms and languages that might be better suited for different software problems. Another aim of the study was consequently to look into the difference in readability between object-oriented and functional code generated by AI.
This was done by prompting the two AI tools Google Gemini and Microsoft Copilot with the same five coding challenges, except that they were told to either generate the solutions in object-oriented JavaScript or functional JavaScript. This resulted in 20 different code snippets. Data was then retrieved from the code snippets regarding different readability features.
The results indicate that the readability of the code generated by the AI tools varied, and that the different AI tools were perhaps better at different programming paradigms. However, the current study is mostly an initial step towards examining the readability in AI generated code.
Place, publisher, year, edition, pages
2024. , p. 50
Keywords [en]
Code readability, code generation, generative artificial intelligence, AI, LLM
National Category
Computer Sciences Software Engineering
Identifiers
URN: urn:nbn:se:bth-26330OAI: oai:DiVA.org:bth-26330DiVA, id: diva2:1865162
Subject / course
PA1438 Självständigt arbete Webbprogrammering
Educational program
PAGWG Webbprogrammering
Supervisors
Examiners
2024-08-192024-06-042024-08-19Bibliographically approved