From time to time, discussions about AI coding tools dominate my Mastodon and LinkedIn feeds, with opinions ranging from complete adoration to utter disapproval.
So, are these tools inherently good or bad? As with most things, the answer lies somewhere in the middle: it all comes down to how you use them.
The Current Landscape
Recent years have witnessed significant advancements in Large Language Models (also known as Generative AI), leading to the development of “AI tools” designed to assist developers with coding tasks.
Tools like GitHub Copilot and ChatGPT are becoming increasingly popular among developers. They unlock new possibilities, such as enabling us to write code in unfamiliar languages, and streamline existing tasks that would typically take longer.
The Hallucination Hazard
Before delving into the pros and cons, it’s crucial to acknowledge that LLMs can hallucinate. This means that under certain conditions (which can arise unexpectedly), the model might generate inaccurate or fabricated information.
Even ChatGPT acknowledges this limitation, stating at the bottom of each page:
ChatGPT can make mistakes. Consider checking important information.
A Case for Good Usage
Prior to ChatGPT, my go-to resource for coding conundrums was Google.
Example: “How do I find duplicated SQL rows with the same field?”
I would search for a solution, read numerous blog posts, try to understand if a solution was feasible, and then refine my search to find code examples (typically on Stack Overflow) that I would need to adapt to my existing codebase after consulting documentation.
Posing the same question to ChatGPT yielded a correct (at least in my experience) SQL query accompanied by an explanation of the syntax used. I tested this query on a local database, adjusting field names accordingly, and it produced the desired result.
While I still needed to integrate the generated code into my project (renaming fields, incorporating it within a larger context, etc.), it undoubtedly saved me a significant amount of time compared to my previous workflow.
Think of AI tools as driving assistance systems: they are not meant to drive for you, but they can assist in maintaining a safe distance from other vehicles, staying within the speed limit, and warning you about potential hazards while overtaking.
In Conclusion
AI tools have the potential to be incredibly useful for coding tasks. However, like any tool, it’s our responsibility to use them appropriately and ensure the accuracy of the final output. Remaining vigilant in preventing the introduction of erroneous information or malfunctioning code is paramount.