Generative AI has seized the popular imagination and started a new tech gold rush. While much attention has been focused on AI tools that produce natural language prose and visual art, in tech circles AI is gaining increased interest for its coding capabilities. You can describe a program you want to an AI chatbot, and it returns executable code to you within seconds, something that both intrigues and unnerves the average programmer.
The prospect of AI-driven programming has led to some fairly grandiose predictions about the future of the software industry, particularly from C-suite execs, consultants, and the pundits who follow them. But what about the programmers and managers who work with AI tools on a day-to-day basis? We asked a handful of people programming with generative AI how it's working out for them so far. What we learned is that AI really is changing the way people work—but machines aren't about to replace human coders anytime soon.
How AI helps coders
The two generative AI tools most commonly used by developers we spoke to were ChatGPT—the widely known AI chatbot from OpenAI—and GitHub Copilot, which integrates into Visual Studio and other IDEs. While both tools can generate code based on natural language queries, Copilot and its experimental successor, Copilot X, can go one step beyond the conversational model, acting as a sort of souped-up IDE autocomplete that anticipates what the developer is working on.
Vanessa Freudenberg, co-founder and chief architect at Croquet.io, says that she uses GitHub Copilot in her daily coding with Visual Studio Code. She explains how it works.
If I write the line:
it will automatically suggest the next line:
let x = this.leftMargin + this.width / 2;And it knows that it needs to replace "width" and "left" with "height" and "top". That saves me a lot of typing.
let y = this.topMargin + this.height / 2;
Panickos Neophytou, co-founder and CTO at NetBeez, says he uses Copilot X and ChatGPT anytime he codes. He describes two different approaches to getting beyond autocomplete with these tools. The first is systematic. "Describe a very well-defined function with specific inputs, examples of expected outputs as well as the data models involved, which include database tables with implicit associations," he says. "AI can generally infer the associations. Ask it to implement it in a specific language and specific ways. The 'tasks' defined in project management tools should be defined as this kind of prompt."
He also thinks a more casual and conversational technique can produce good results. In this mode, he says, "while performing a task you ask questions that pop up in your mind about how to do certain things. This is like having an experienced engineer next to you answering your questions and guiding you towards finishing the task."
No matter what technique you use, learning to prompt the AI correctly is something of an art. "I use chain-of-thought prompting to ensure I get the correct verb to start and refine my prompt," says Shanea Leven, founder and CEO of software provider CodeSee. "Choosing the right verbs and being descriptive are really important for creating a good prompt." (Prompt engineering is becoming a hot discipline for this very reason.)
AI's coding strengths
The developers we talked to offered a variety of use cases where AI tools helped them get their work done. Here's what stood out.
Generating documentation from code
Software documentation is a fairly structured format, which is an area where AI thrives. "Something I love using ChatGPT for is writing documentation [or] comments in my code," says Chris Love, founder of web consultancy Love2Dev. "That takes so much time to do by hand. But once I have a function complete I can give it the function and have a nice page worth of documentation written in a second or two. I love that!"
...and vice versa
AI can also generate code based on comments or documentation. Croquet.io's Freudenberg gave a simple example of Copilot generating code from only one comment line, where the following comment:
// get file name from our url
produced this output:
let fileName = window.location.pathname.split("/").pop();
"I probably would have written this differently—I'm a regex girl—but it's a perfectly simple and arguably more readable solution, so I would just accept it," she says. "It's not only a huge time-saver, but sometimes it also teaches me idioms I may not have discovered myself."
Solutions to solved problems
Developers know that part of programming is constantly reinventing the wheel. It can be frustrating working on a problem that you know someone, somewhere, has already solved. Jeff Wills, engineering practice lead at software development firm Rise8, sees this as a domain ripe for AI assistance. "Let's say I make a method to calculate the distance between two points on a sphere," he explains. "Copilot will automatically go out and find the Haversine algorithm and generate all that code."
Wills finds this use case particularly handy in cases where the alternative to AI-generated code is adding a large library to his application. "Say I don't want to bring a whole geometry library into my code and bloat the codebase," he explains. "I really only need that one algorithm. I'll probably just write it myself and include it—or use ChatGPT or Copilot to help me produce that. That's the bread and butter for AI right now."
Updating or cleaning up code
Chris Love of Love2Dev finds ChatGPT particularly useful for updating code he's already written. "I have tackled updating old Node.js modules that I have not updated just because the time it takes to type the code is longer than it is worth," he says. "The most common situation I look for is converting older promise-based functions to use async/await. The latter is a cleaner syntax, but was not as common when I wrote the module. I also get it to use more modern syntaxes like destructuring and converting variable declarations from var to const and let."
Faster coding (maybe)
Many developers we spoke to said that working with Copilot or ChatGPT made them feel like they could do their work more quickly, though they admitted they couldn't necessarily quantify that. "What I think it does in the end is help me write better code a little faster," says Love. "It is difficult to say what percent faster, but it is tangible to me."
I feel like I can iterate through possible solutions faster" says Rise8's Wills. "That should theoretically speed me up—but maybe I'm looking at more possible solutions! So maybe I don't get a payoff in time, but in quality, because I was able to iterate a little bit more."