5 ways I use ChatGPT in my daily workflow as a software developer

Petros Demetrakopoulos
3 min readNov 16, 2023

--

Photo by Mojahid Mottakin on Unsplash

Since late 2022, ChatGPT has gradually entered many aspects of our daily lives, automated or simplified processes and enhanced productivity. Without even consciously noticing it, I caught myself using ChatGPT with an increasing frequency for accomplishing simple (or harder) coding tasks I perform during a normal working day.

Here are the 5 ways I use it to make the most out of it as a professional software developer.

1. Write docstrings

ChatGPT is AMAZINGLY good at writing concise and informative docstrings for functions and classes. You can simply copy a function and as it to write the docstrings. The model is capable of understanding what the function does, many times even on a higher / more abstract level and document it as well. Sometimes, the format may differ a bit but you can always adjust it to what you need with an additional prompt. So no more time spent writing docstrings for functions and classes.

2.Refactoring

Refactoring is a very broad term containing various tasks that mαy need to be performed in code that has been written long in the past or it is not well implemented or documented. Parts of refactoring may be renaming variables and declarations with more appropriate names, split large functions and classes to separate smaller ones, reimplementing a part of the code with less lines etc. Thankfully, using the appropriate prompts ChatGPT is capable of accurately performing the majority of these tasks. From declarations renaming to splitting function into smaller and more discrete parts, ChatGPT will help you write cleaner and more straight-forward code that is maintainable and readable by you or fellow developers.

3. Write unit tests

ChatGPT is able to write unit tests saving you lot of time during the development lifecycle of any project that involves coding. A tasks that many times is much needed but may be extremely mundane, boring and time-consuming at the same time. By pasting a function and asking ChatGPT to write the unit tests, the model will perform the task and ensure that various aspects of the function are tested. If the function is complex, additional prompts may be needed to cover all cases.

4. Bug fixing

Yes! ChatGPT can even identify and solve various bugs or logical errors. Even in cases that are non-trivia, the model is able to find many bugs and also provide the updated code that corrects them. So the next time that you have any intuition that a function or class may not work as expected, feel free to paste it in ChatGPT and ask it to identify any potential bug.

5. Understanding code snippets written by other developers

This is one of my favorites and probably the most useful one. Many times you may encounter badly written or not properly documented code written by others. Instead of spending tons of hours into trying to understand what the code does and probably involving some back and forth of communications with the fellow developer(s) who initially wrote the code, you can try asking ChatGPT what the code does. Most of the time, the model will have a very clear an concise answer.

Conclusion

ChatGPT is certainly a valuable resource for any person that tackles with software development. It can minimize effort for simple tasks, leaving more time for the actually hard tasks that need more investment and time to be properly resolved. However, as al AI tools, it is essential to cross-check its suggestions, especially for complex or critical tasks, as it may not always provide the most up-to-date or context-specific information.

--

--

Petros Demetrakopoulos

💻Code-blooded, 🌏 Traveler, . Lifelong learner 📚. Currently studying Data Science and AI at TU/e, Eindhoven, NL. https://petrosdemetrakopoulos.github.io