The generative pre-trained transformer chatbot (ChatGPT) is used as a search engine that replaces Google. It also serves as a generator of a variety of things, from images to meal planning and role-playing games [1]. A specific feature of the chatbot makes it especially relevant to developers — it can read and write programming code. How and to what degree can one take advantage of its possibilities? Is the ability to know how to use ChatGPT a must for every developer?
Analysis tool
The ability to quickly read and analyze a big chunk of supplied code makes ChatGPT a useful tool for code comprehension. However, the important advantage is that it also generates suggestions and real-world examples of improving and applying the supplied code. Even for a senior developer, the chatbot can be helpful when it comes to summarizing the main purpose of a huge code, which would otherwise require the developer’s time to read and understand it. The so-called “cognitive load” that occurs when a programmer gets acquainted with a new code can be decreased by supplying it to the chatbot. Without the need to ask any questions, just by providing the code, the developer gets a response in a matter of seconds. It usually starts with a simple overview that explains in simple terms the purpose of the code, its key features, and, eventually, its code dependencies. The fun starts when it comes to the code analysis.
Code analysis entered history long ago, in the 1970s, when Lint emerged [2]. Today, however, developers have the possibility to not only analyze the strengths and weaknesses of a big chunk of code but also get knowledge about potential bugs and suggestions for code improvements. After the analysis, the chatbot provides applicable code that can be copy-pasted by the developer for fast improvements. Then how about supplying ChatGPT with every new code that the developer creates?
Several major companies have restricted employees from using the famous chatbot due to privacy concerns [3]. As a big company, Apple showed the way towards protecting company data, which can be observed as the reason why banks like Bank of America, Citigroup, and others restrict their employees from using ChatGPT for work purposes [4]. On the other hand, OpenAI has allowed its users to stop ChatGPT from training its models with user-supplied data, which is why companies like Forcepoint state that the chatbot can be safely used as a developer tool [5].
Another problem of a developer using ChatGPT for industrial software code analysis is that the improvements that the chatbot suggests may not follow the naming conventions of the variables, functions, and classes that the company has applied. Also, programming patterns that are adopted by the team might be disrupted by the provided code suggestion.

A fast search engine
After all, ChatGPT can serve as a fast search engine that has vast amounts of data from different contexts — not only for searching for stuff to buy or places to go, but the chatbot can also serve developers as a fast documentation provider. If developers are working with several languages, they might forget how to do simple operations with a given language. String transformations, date operations, or regular expression writing are typical examples of how ChatGPT can quickly provide code examples that can save some of the time of the programmers. These applications can be described as documentation solutions, as they are simple and can be found by surfing the web. This, however, would require the programmers to open a search engine and take some time to find the things they need.
When asking a specific question, like how to get the number of the week in terms of a year by having a date, the chatbot will quickly provide an example code with the usage of the function. This will save some of the time for the programmer to search on the web and to write the function. However, when it comes to more specific requirements like getting the date of the Monday of the week by having a week number and a year, the chatbot may not be able to help; what is more, it might lead to having unknown bugs in the written software.
Personal experience
As a Full-stack developer, I need to write code in different languages like JavaScript and Python by using several frameworks and software tools (third-party libraries). What is more, I need to do this fast when it comes to solving simple problems like the one described above, which would still take some minutes. As such, I am a developer who can take advantage of ChatGPT, which will help me concentrate more on higher-level problems like designing and securing system operations. When it comes to transforming a decimal number of hours to a string of time in a format <HH:MM>, I might not know the name of the “padStart” function.

The screenshot above shows how the chatbot has applied the “padStart” function in order to achieve the correct format. For example, if the decimal 2.5 is provided to that function, the result is going to be “02:30” with the “0” in front.
Another example of an application can be given with a framework like Vue.js. In the software company where I work, our team uses Vue.js to achieve dynamic transformations of the web page without reloading it (Single Page Applications). In a specific scenario, we might need to know whether or not a specific implementation of a variable will achieve the results we want. By asking ChatGPT, it would provide us with information from the documentation of Vue.js and a suggestion with code examples. A problem might be that the information it provides might not be the newest one if, for example, a recent update on the framework has been done.
Some dangers exist when using the famous chatbot for code writing. On a specific occasion, a specific function for getting a date had to be developed. I demanded the chatbot to provide me with a function that takes two parameters: a week and a year number and returns a result of a date on the first Monday of the year. The function seemed to be working until I realized that in the case of the beginning of the year, it was returning the Monday of the last week of the previous year. This is because, in the ISO calendar standard (from ISO-8601), the first of January might be, in some cases, part of the last week of the previous year, as shown in the images below.


If this function had not been tested with different years as parameters, it would have remained in the software, and bugs would have occurred in the future. That is why, after all, the provided by the chatbot software needs not to be fully trusted. The written code is not run, so the chatbot cannot be sure whether or not it is working in all scenarios.
Generator of test code
When a developer needs to test their own functions, ChatGPT can be used to generate and provide testing data. The latter can be used by the developer or the QA to battle-test the written code. For example, when having a function that applies specific rules for personal ID numbers, the chatbot can usefully generate a large amount of such data. Otherwise, you would have to search for actual personal ID numbers, as there are specific requirements for the last digits depending on the country.
For a very short time, the chatbot can generate test data in specific demanded by the developer structure. For example, it can be asked to generate many different JSON objects that include properties like email, age, and name, and it will provide the unit test writer with data that has specific characteristics demanded by the prompter.
Conclusion
Even though it has some drawbacks, ChatGPT can serve as a fast search engine that provides specific answers in a matter of seconds. Having vast amounts of data from different contexts, it can suggest programming solutions, which, however, must be tested by the developer. It serves well for quickly generating code that does not depend on other project code. If the developer manages to apply the “divide and conquer” technique towards having simple functions, ChatGPT would be of help in generating applicable code.
References:
- https://www.pocket-lint.com/ways-people-are-using-chatgpt/
- https://www.sonarsource.com/learn/static-code-analysis/
- https://www.businessinsider.com/chatgpt-companies-issued-bans-restrictions-openai-ai-amazon-apple-2023-7
- https://www.forbes.com/sites/siladityaray/2023/05/19/apple-joins-a-growing-list-of-companies-cracking-down-on-use-of-chatgpt-by-staffers-heres-why/
- https://www.forcepoint.com/blog/insights/does-chatgpt-save-data
Subscribe to our newsletter
Enjoying our content? Subscribe to the TechTalents Insights newsletter and get our best articles and interviews delivered directly to your inbox. Click here to join the community!