Chatbots As Fluent Polyglots: Revisiting Breakthrough Code Snippets

David Noever,Kevin Williams
2023-01-06
Abstract:The research applies AI-driven code assistants to analyze a selection of influential computer code that has shaped modern technology, including email, internet browsing, robotics, and malicious software. The original contribution of this study was to examine half of the most significant code advances in the last 50 years and, in some cases, to provide notable improvements in clarity or performance. The AI-driven code assistant could provide insights into obfuscated code or software lacking explanatory commentary in all cases examined. We generated additional sample problems based on bug corrections and code optimizations requiring much deeper reasoning than a traditional Google search might provide. Future work focuses on adding automated documentation and code commentary and translating select large code bases into more modern versions with multiple new application programming interfaces (APIs) and chained multi-tasks. The AI-driven code assistant offers a valuable tool for software engineering, particularly in its ability to provide human-level expertise and assist in refactoring legacy code or simplifying the explanation or functionality of high-value repositories.
Machine Learning,Computation and Language,Software Engineering
What problem does this paper attempt to address?
The problem that this paper attempts to solve is: By using AI - driven code assistants (such as ChatGPT), re - examine and analyze the most influential computer code snippets in the past 50 years. Specifically, the research aims to: 1. **Understand the importance of historical code**: By re - examining historically important code snippets, understand the impact of these codes on the development of modern technology. 2. **Improve code clarity and performance**: In some cases, provide significant improvements to enhance code readability and execution efficiency. 3. **Interpret and optimize complex code**: Provide in - depth explanations for difficult - to - understand code or software lacking comments, and generate additional sample problems based on error correction and code optimization. 4. **Automate document generation**: Future work will focus on adding automated document generation and code comments, while selectively translating large codebases into more modern versions, introducing new APIs and multitasking. ### Main contributions - **Re - examine historical code**: The research selected the most influential code snippets in the past 50 years and analyzed them through AI - driven code assistants. - **Provide in - depth explanations**: For each code snippet, the AI assistant not only explains its function but also provides possible optimization suggestions. - **Cross - language translation**: Demonstrated how to translate historical code snippets into multiple programming languages, including some less - used languages such as Curry, Fish, and Glee. - **Application prospects**: Explored the potential applications of these tools in future software engineering, especially in refactoring legacy code and simplifying the functional explanations of high - value codebases. ### Method Researchers achieved the above goals through the following steps: 1. **Select code snippets**: Select samples suitable for analysis from historically significant code snippets. 2. **Ask questions**: Ask ChatGPT questions about these code snippets, such as "What does this code do?" or "Please explain this ambiguous function." 3. **Get responses**: Record ChatGPT's responses and further inquire as needed to obtain more detailed explanations or optimization suggestions. 4. **Verify results**: Verify whether the answers provided by ChatGPT are accurate and useful by comparing with the explanations of human experts. ### Results The research results show that ChatGPT can effectively interpret and optimize various historical code snippets, demonstrating its powerful ability as an AI - driven code assistant. Specific cases include: - **Assembly code of the Spacewar! game**: Explained the basic mechanism of the game and translated it into Python. - **COBOL code of the early e - mail system**: Explained the process of sending and receiving e - mails and translated it into Python. - **Memory management code of the Apollo 11 lunar module**: Explained the function of the BAILOUT operation and its priority adjustment mechanism in case of memory overflow. - **JPEG image compression algorithm**: Explained in detail the process of the discrete cosine transform (DCT) and its application in image compression. Through these cases, the research has proven the great potential of AI - driven code assistants in understanding and optimizing historical code, providing a valuable tool for future software development and maintenance.