top of page
Writer's pictureAnand Muley

Pair Programming with ChatGPT

Disclaimer: The content of this blog represents my views and understanding of the topic. I do not intend to demean anything or anyone. I am only trying to share my views on the topic so that you will get a different thought process and angle on this topic.

ChatGPT is a generative AI that can generate code. The general public, including some software developers, is still afraid of AI and its potential. Initially, everyone thought an AI would not be able to write code, but ChatGPT is proving that idea wrong. It is human nature to fear something that we don't understand. However, we should accept the fact that progress requires evolution to the next level, not only in what we do but also in our thought processes.


Programming is a way of communicating with machines and telling them how to achieve a task. With ChatGPT, we can take it to the next level. Now we can speak in terms of concepts and requirements for a machine. I tried ChatGPT as a pair programming partner and would like to share my understanding and experience of ChatGPT.

ChatGPT can efficiently perform the task of code generation based on its learning, but it has some preferences that we can request it alter according to our requirements. For instance, I requested it to create a React component, so it preferred to use a function component. However, if our use case requires a class component, we can ask it to alter a component accordingly. ChatGPT (GPT-4) only knows the cutoff until September 2021, which means it is not aware of the latest updates after that. Hence, it was referring to some NPM dependencies that were deprecated from the NPM repository.


ChatGPT is like an experienced programmer with some perceptions of its own based on the knowledge it has. Hence, when I asked it to help me update a file inside a jar without unzipping it, ChatGPT said it was not possible. However, when I directed it to check if the Oracle jar command has some options, it corrected itself beautifully.

ChatGPT is contextual, but when the complexity of the discussion increases, we should have some keywords created for grouping stuff. For instance, I was discussing the async API documentation of the SocketIO server, and I asked it to generate one. It generated a document that was not correct, so I shared the correct document as a reference and asked it to correct it. However, it took some time in the discussion, and then ChatGPT lost the context of the original specification document we were working on. In such cases, we need to remember the document name to help ChatGPT understand what we are referring to.

ChatGPT could not show a UI when I was working on UI creation using ReactJS and the MaterialUI library, but it could describe it. I think the next version of ChatGPT should have the option to have a kind of whiteboard to discuss more effectively as we do during our meetings. ChatGPT can only be trained by the OpenAI team. Whatever coding ChatGPT can do is based on the data it was trained on by the OpenAI team. Also, ChatGPT cannot generate a zip file or jar file of the project; hence, we need to create and manage each file by copying the code from the prompt to our local.

I found ChatGPT a very useful pairing companion. Although we cannot use ChatGPT for some tech stacks that were released after 2021, overall, it has learned events until 2021 very well. Chatting with it is a new language of communication that requires practice and a structured approach. It is like practicing programming a new language that does not have any official documentation yet. We can create our structure while chatting with ChatGPT. I will share more learnings after spending more time with ChatGPT.

 

What are your thoughts on using AI, such as ChatGPT, as a pair programming partner? How do you think it can enhance the software development process and communication with machines? Let me know what you think of ChatGPT in the comments.

Comments


bottom of page