Skip to Content

Achieving sustainable code with AI Code Reviewers

Lars Snellingen
July 31, 2023

We all know there have been discussions on using Generative AI and the pros and cons this new chapter of technology gives. I want to share how Generative AI may assist QA test engineers in their everyday work. And that is writing more sustainable code with AI using it to assist in reviewing your code.

As I have mentioned in my blog. “A way to sustainability through a clean code” a way to shift focus towards sustainable code. And achieving this with focus on writing clean and effective code that is easy to maintain and refactor. This can be enforced through high-quality code reviews. When done right it will be effective to use Generative AI to perform this task. 

Getting feedback on your code from Generative AI

Enabling quality code reviewers

To enable Generative AI to give quality code reviews it is important to give instructions so the feedback follows best practice. You also need to define the experience of the reviewer and how you want the comments to instruct improvements. When reading the feedback it is important to be critical to find what needs to be improved. This will help with finding where to continuously tweak the instructions to gradually improve the value of the code review.

Where to begin?

So to begin using Generative AI in code review a good starting point is to define a set of rules. The rules should encapsulate what your way of working is when writing and reviewing code. I would recommend starting with a list of rules giving a concise guideline. Start with your most important areas and gradually build this rule set over time through experimentation. 

The experience of the reviewer is also relevant. It is possible to give intructions so the Generative AI has different experience. There are benefits of testing feedback from both an experienced programmer and someone with experience in different fields. The given experience will affect the code review both in how the code gets analyzed and how the comments in the feedback is formulated. In this segment of instructions, it is especially important to experiment. With experimentation you will find what gives your team and you the most value. It is possible and advisable to personalize this in order to maximize its advantages for each person in a team.

The way you fine-tune how the feedback should be presented has the potential to yield the greatest value from the code reviews. That is because you may just give the Generative AI the first two parts of the instruction. This process involves the Generative AI modifying the code, which you then needs to be reviewed by you. However, this approach may not give the same learning benefits as reading comments, making improvements, and gaining insights on writing code in different ways.

If you are interested in utilizing and experimenting with code reviews using Generative AI, I would appreciate hearing from you. What are your experiences and how you plan to leverage this new assistance in your approach.

About the author

Managing Consultant | Norway
Lars Snellingen is the community lead of SogetLabs Norway and is one of Sogeti’s experts in technical testing with a deep knowledge in UI automation and API automation. He has been involved and fully responsible of testing multiple system transitions from on-prem to cloud in the retail industry.


    Leave a Reply

    Your email address will not be published. Required fields are marked *

    Slide to submit