One of the greatest strengths of ChatGPT is to write code in any coding language imaginable. Harvard Business Review argues that today there is no need for IT professionals to design and build new applications (Davenport et al., 2023). But how do I make use of ChatGPT as a coding assistant properly? What issues can I expect? How can ChatGPT be used for debugging and what potential does it offer when integrated directly into programming environments? Those are the questions I want to explore in this blog post.
ChatGPT on its surface is simple. If I ask it to write code that performs a certain task in a certain language I will receive a reasonably good answer. The suitability of the output code is primarily dependent on the quality of the prompt and the context of the coding problem provided. I need to make sure to formulate my problem statement clearly with all necessary context. To further improve the interaction, I ask ChatGPT to explain the code it writes and provide excerpts of my datasets and descriptions of relevant variables so it can tailor the code to the specific data structure. By doing this it can also use the correct variable names and support the first interpretation steps.
However, several pitfalls need attention. First, ChatGPT’s answers are constrained by token limitations, meaning a code snippet might get cut off if it’s too long. Second, there’s no guarantee the code will be syntactically correct or optimized for my specific environment. As ChatGPT as of today still has a knowledge cut-off in 2021, it may also use outdated practices. Therefore it can only serve as a starting point and always has to be improved upon.
Luckily, ChatGPT can not only help with writing code but is also a great tool for debugging code that has been tested in your specific coding environment. Most issues can be resolved by simply pasting the code and error message into ChatGPT and following the resulting recommendations.
Now imagine a future where ChatGPT or similar AI models are fully integrated into your coding environment. Real-time code suggestions, automated debugging, and even code optimization suggestions are all not far-fetched. This level of AI integration could overcome most of the pitfalls discussed earlier and dramatically alter the nature of coding, making it faster, more efficient, and even more accessible to those without formal programming education. What do you think? Let me know.
Davenport, T. H., Barkin, I., & Tomak, K. (2023, September 1). We’re All Programmers Now. Harvard Business Review. https://hbr.org/2023/09/were-all-programmers-now
ChatGPT as a Virtual Coding Assistant: Promises and Pitfalls
21
October
2023