Using GPT to do Code Reviews : A non-tech POV
Suhas Dutta
Driving business value - Strategy Consulting to tech powered execution. Digital Transformation. Growth, innovation, & efficiency for promoter-led companies. | Keynote Speaker | Photo Expedition Leader
As GPTs start gaining popularity, there are gradually being used for many non-trivial functions. My daughter was writing some pieces of #python code which I was reading through and thought it would be fun to use GPTs to do code reviews. Of course, there are many such AIs available on the web, some of which are now plugged into IDEs (e.g. GitHub CoPilot) too and help with coding based on prompts. But, what if one didn't have an advanced IDE, what if a business / methodology person, not familiar with AIs like #CodeGuru (from 亚马逊 ), or #Codex ( OpenAI 's coding tool accessed through its API), want to facilitate a code review using a GPT?
The Code Review Process
It took me a few iterations to figure how to optimally use a #gpt to do a code review. I used #chatgpt 3.5, and 4.0 (through #bing ). Here's what works most effectively while using a GPT effectively for doing reviews:
An Illustrative Review
Following is what I tried, with a short code snippet that I wrote?
Me: Need you to review the following Python code that I just wrote. The following code is required to calculate the factorial of a given number. After reading the code, please answer only in YES or NO, if you understand it.?
Me: ok, need you to review the code, and tell me if there are inefficiencies and if you can make the code better.?
领英推荐
Me: Can you make the code a little more efficient?
Now, the thing is, one needs to do this iteratively through the entire coding process to get optimal results.
However, regardless of the great potential, let us not overestimate a GPT's capabilities. Current AI tech, including language models and coding tools, have limitations and do produce erroneous or hallucinatory outputs. Human involvement and verification is still essential to ensure accuracy, catch potential flaws, and provide the necessary contextual understanding that AI lacks. So, don't just completely rely on the GPT to do your reviews, but a balanced approach that combines the strengths of the GPT with human judgment is essential for achieving reliable and effective results.
--------------------------------------------
What do you think? Write in to?me, or?3nayan, if you want to know more about how to make your organization more effective in today’s fast moving world.
#opinionsmyown | Content copyright 3nayan
Suhas?is co-founder, Partner at?3nayan, a niche Strategy Consulting firm which helps Growth Enablement and Organizational Effectiveness through services in Strategy Re-Energization, Process Engineering, Integrated Process Automation and Digital Transformation.