Exploration

My Top 3 Quick Takeaways On GenAI

December 9, 2024

Within the past couple of years, there has been an increase in interest about GenAI and how it can help accelerate software developers with their work. In the past few months I’ve had the opportunity to use GenAI tools such as Copilot to help with coding and various other tasks associated with software development and design such as documentation, understanding code, refactoring, etc. Here’s my top 3 quick takeaways on GenAI! I’ll try to provide examples in each one linking to the prompts and responses themselves.

Help with explaining code

This is by far one of the greatest advantages of using GenAI as a coding companion. It greatly accelerates understanding of complex code especially legacy code. You can have GenAI tools like ChatGPT or Copilot analyze complex code and give you line by line explanations of what the code does.

Example using ChatGPT to help explain the initialization of a Jackson ObjectMapper object:

https://chatgpt.com/share/67579fa5-2a40-800c-8b1d-dffb4c74dc9f

Help with generating test cases

Another thing that GenAI is good for is generating test cases, especially if you’re not familiar with a test framework! Even if you do use GenAI to help write test code, don’t rely 100% on what is given to you. You must still do you due diligence and test to ensure that the code works as you’re expecting it to.

Example using ChatGPT to help generate test cases using Kotest for the above ObjectMapper example:

https://chatgpt.com/share/6757a03b-b5b4-800c-b5fa-58f7fdacfbbf

Help with refactoring code

Another useful thing with GenAI is the ability to help refactor code to make it simpler to understand and often times, more efficient.

Example using ChatGPT to simplify a foreach loop into something more efficient and simpler:

https://chatgpt.com/share/6757a32f-360c-800c-93ba-4f8df66a80b2

The above example is just a simple example and doesn’t reflect more complex real world examples but the point is to focus on what the GenAI tool was able to do for you as a developer.

Final thoughts

GenAI is great when used as a coding companion, but should not be relied on 100% of the time. Just like with any tool, it’s there to help you be more efficient at your work as a developer. In order to use it well, you also need to understand how to formulate prompts that are as detailed and concise as possible to ensure that the response from the LLM is specific enough to what you’re asking of it.

Will GenAI replace us as software developers? Likely not for a long time. It can surely help us improve our knowledge and skills by leveraging it properly instead of avoiding its use all together.

You Might Also Like

No Comments

Leave a Reply