AI-Assisted Coding Revisited
Since writing my last blog post on “vibe coding”, I’ve been looking for ways to incorporate AI into my workflow that take advantage of its strengths and avoid its weaknesses. While it’s pretty clear that hallucinations and its difficulty interpreting context a lot of the time make it something you can’t quite rely on yet to produce high-quality projects out of the box, I have been finding tasks that LLMs seem well-suited for.
One such task I’ve had some success with recently is code review. Rather than have the AI write the code, I will write the code myself and then upload the file to an LLM to have it make suggestions for improvement. When writing code for a sizable project, it can become easy to get focused on the architectural or higher-level considerations and miss some of the finer details or concepts I'm less comfortable with as I try to maintain a certain level of productivity. Questions about which approach is more performant, maintainable, or readable can often get lost in a flow state where I go with what I know works, so I can move on to the next task. Using an LLM to look over my code can allow me to maintain this flow and then revisit these areas where some of the more granular details may have been implemented in less-than-optimal ways. I then check its suggestions against my own knowledge and that of other people, which closes the loop, ensuring I'm not blindly following what could be convincing but bad advice. I have found myself disregarding its suggestions at times but still find it much quicker at doing these kinds of checks than going line-by-line myself or waiting on people who are busy with their own work to respond to my questions.
Beyond code review, I've also found AI to be a powerful tool for a related task: debugging. While modern code editors have massively reduced the time spent hunting for missed curly braces, parentheses, or semicolons, more subtle bugs and silent failures can still be small issues that have me poring through code for an unreasonable amount of time. LLMs can quickly identify these kinds of bugs and save many minutes on such scavenger hunts.
Another way in which I’ve found LLMs helpful is introducing concepts of which I have little to no awareness. While this does get into territory where I have to be more judicious of the advice it gives and properly vet anything unfamiliar against the knowledge of human experts, the fundamental nature of LLMs as token association machines really shows its strength in bridging knowledge gaps that may be much more difficult or time-consuming to connect via search engines or textbooks. Even human experts, whose knowledge is often highly focused in certain subject areas, can miss more disparate associations. The gargantuan scale of modern large language models can really help to transcend the boundaries of these knowledge silos and make it easier to form such connections. Even if I ultimately reject an idea because it’s inappropriate for my use case, I am often left having gained awareness of something I would have been blithely oblivious to had the scope of my search been limited to achieving functional code.
In a similar vein to these free-association exercises, using an LLM to go down rabbit holes of curiosity is usually much quicker and more focused than undertaking this task via classical search engine or textbook. If there is an area in which I feel my knowledge could use some buffing, I can efficiently explore the lingering questions I have about concepts and feel more confident that I’m aware of important caveats and considerations so as not to misapply newfound knowledge. Again, I need to stress that this confidence is gained after having vetted the AI’s responses against formal literature, but knowing where to look would have often been much more difficult and time-consuming without having an LLM to guide the pursuit.
While I’m aware of people using AI in more creative and interesting ways, these are the most compelling uses I’ve found for AI in my workflow so far. In the coming months, I’m eager to discover how else I can leverage the strengths of these tools to produce higher-quality work even more productively.