Turning to Generative AI for Some Coding Help
What you’ll learn:
- Why one must take care when coding with generative AI.
- The challenges of vibe coding.
- How to get tips on Javascript coding.
Large language models (LLMs) and generative AI are having an impact on programmers and developers. While I’ve cautioned about the use of vibe coding embedded systems, I’ve had a chance to do so with a small Javascript project lately.
I assume most Electronic Design readers have heard and know about vibe coding. If not, it’s the use of chatbot technology to generate applications using text specifications. Agentic AI takes this a step further with artificial-intelligence (AI) models controlling applications based on their instructions. In simple case, this may be refactoring existing code based on chatbot prompts.
Chatbot Prompts and Programming in General
Before getting into my project and use of AI for coding, I wanted to include some comments about how people seem to be looking at chatbots as tools. I haven’t done an exhaustive study of the various coding tools and plugins. Much of what I did for my project used the free version of chatbots like ChatGPT and Perplexity, as well as plugins for free IDEs such as Eclipse.
What I did find is that working with chatbots is much like programming, but the programming language is a language like English and open-ended. The more precise I made my instructions, the better the results were without having to refine things with subsequent prompts.
Of course, there are all sorts of prompt generators, guides, and whatnot to “improve” interaction with the chatbots. However, the challenge is that the syntax and semantic specifications for the interaction are presented to the user, in part, because they might limit how users would interact with the system.
Unfortunately, this flexibility is why it can be hard to use AI in the long run. The underlying systems are continually changing — in theory, being enhanced. Likewise, giving my prompts for others to use may not provide them with the same results.
The imprecise nature of LLMs and chatbot technology makes it challenging to address details like security and reliability reliably. This becomes more challenging the longer your session runs, as well as when the problem and data space increases in complexity.
What Worked for Me and What Didn’t
My project was a Chrome browser extension written in Javascript. I’ve used Javascript from time to time when supporting Drupal modules that I wrote in the past. These tended to do tasks a bit different than writing an extension, so I needed to learn a few things. This is where AI worked well.
Having a chatbot generate code for a sample extension was trivial and asking for references was a good indication of where the information came from.
I already had a good idea of what I wanted my program to do, so more of my AI requests were for portions of the program rather than asking for a complete solution. Given the limitations of the chatbots I was working with, it would be unlikely that the chatbots would be capable of handling the full scope of the project. Luckily, I have the programming expertise and knew what and how I wanted the extension to work.
>>Check out this TechXchange for similarly themed articles and videos
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.
Vibe Coding Quick Poll
>>Check out this TechXchange for similarly themed articles and videos
About the Author
William G. Wong
Senior Content Director - Electronic Design and Microwaves & RF
I am Editor of Electronic Design focusing on embedded, software, and systems. As Senior Content Director, I also manage Microwaves & RF and I work with a great team of editors to provide engineers, programmers, developers and technical managers with interesting and useful articles and videos on a regular basis. Check out our free newsletters to see the latest content.
You can send press releases for new products for possible coverage on the website. I am also interested in receiving contributed articles for publishing on our website. Use our template and send to me along with a signed release form.
Check out my blog, AltEmbedded on Electronic Design, as well as his latest articles on this site that are listed below.
You can visit my social media via these links:
- AltEmbedded on Electronic Design
- Bill Wong on Facebook
- @AltEmbedded on Twitter
- Bill Wong on LinkedIn
I earned a Bachelor of Electrical Engineering at the Georgia Institute of Technology and a Masters in Computer Science from Rutgers University. I still do a bit of programming using everything from C and C++ to Rust and Ada/SPARK. I do a bit of PHP programming for Drupal websites. I have posted a few Drupal modules.
I still get a hand on software and electronic hardware. Some of this can be found on our Kit Close-Up video series. You can also see me on many of our TechXchange Talk videos. I am interested in a range of projects from robotics to artificial intelligence.


