Turning to Generative AI for Some Coding Help
One area where I found the AI tools to be invaluable involved analyzing web pages that I was controlling via the extension. Of course, recognizing html and Javascript patterns on a web page and matching it with Javascript code and framework support would be hard to find using basic search engine results.
What I found challenging was getting the chatbots to write code. They did a good job of putting together something I asked for, but getting a result that I wanted required iterative prompts. The level of precision in my prompts wasn’t always the issue. Often, I was providing clarification that the chatbot would understand.
They also had a habit of apologizing when prompted about something that didn’t look right or didn’t work when tested. As this wasn’t an agentic situation, I was copying and pasting code that would then be tested with responses provided as prompts to make subsequent changes.
Using AI to Document Code
If you’re like me, you write code first, make sure it’s working, and then document it. There are tools like Doxygen, JSDoc, and phpDocumentor for C/C++, Java/Javascript, and PHP, respectively, to document code. The idea is to include comments that can be processed to generate readable and searchable documentation. The standard comment syntax also makes it clear as to what functions, classes, and structures are supposed to be doing.
All of these tend to be rather verbose and the comments are often longer than the code they describe. On the plus side, they generate readable and searchable documentation. Of course, if chatbots take over coding, then the need for documentation becomes less. On the flip side, AI-generated code to date has been less than stellar, especially when it comes to security and safety. So, eventually, real people like me need to fix things. It’s a much easier job when the code is documented.
The chatbots did well in generating function headers just from the function header definition, but performed even better when the code to the function was provided. The results were generally more verbose than I would like, so pruning the comments was worthwhile and relatively quick.
I’ve yet to use tools that have been integrated with an IDE, but this is likely a place where the time savings would be significant.
Closing Thoughts on Vibe Coding and AI Coding in General
Overall, I’m impressed with assistance provided by the generative AI. It didn’t write the entire project, but it was instrumental in delivering insights and examples for key aspects of the system. It also provided more verbose inline documentation than I would have done on my own.
My main concern is that developers don’t abdicate their designs to AI while having it streamline coding or adding code that isn’t understandable. Likewise, managers need to know that demanding the use of AI and putting high expectations on the results is likely to turn out unsupportable and potentially dangerous code that’s only been examined by the AI.
In some sense, it’s comparable to new users of spreadsheets who think they can generate an accounting package. There are good coding practices and bad ones, and if you don’t look at what’s being done, then it could be very good or very, very bad.
Another consideration that I haven’t mentioned yet is cost. I was using free cloud-based chatbots. It did some experimentation with local generative AI such as Jan and Kidibot. The results were surprisingly similar, although less refined and slower due to the lack of AI hardware acceleration. I need to check this type of platform on some of the NVIDIA platforms I have on hand, but that’s for later.
The end game for all of the AI hype is to get you to pay for it. Therefore, the results need to justify the cost. Right now, the cost usually relates to the time needed to get something to work. This is also an area where developers will need to understand how the costs are incurred, as well as what efficiencies can be gained using different approaches to using generative AI. Moreover, the systems will have limitations, which is another area where developers need to understand what the tool is and what it’s doing.
Hopefully these ramblings provide some insight and encouragement to use AI for coding tasks. These tools are numerous and useful, but they require an experienced hand. Leave a comment if you’ve been using these tools and how the results turned out.