AI pair programming could be a coder's dream or a nightmare in the making. Nine developers talk shop about how they're using generative AI today.
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 (integrated development environments). 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 auto-complete tool 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;let y = this.topMargin + this.height / 2;And it knows that it needs to replace โwidthโ and โleftโ with โheightโ and โtopโ. That saves me a lot of typing.
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 auto-complete 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.โ
Neophytou 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!โ
Generating code from documentation
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.โ
What to watch out for
On the other hand, almost everyone we spoke to emphasized that AI tools arenโt magic and there were plenty of pitfalls to look out for and reality checks youโd encounter when using them.
Be very specific
AI chatbotsโ natural language facilities can seem almost magical, but they probably donโt understand as much as you might think (or hope) they do. You need to be as explicit and specific as possible to get the best results. โCurrently, ChatGPT cannot see what you are coding in third-party apps you are using,โ says Liam Edwards, CEO of Liamโs Professional Websites. โFor this reason, you need to give it as much information on the coding issue or query you have. For example, if I said, โWrite me custom CSS that makes the button background white,โ I would get code that may work or may not. If I said, โWrite me custom CSS code that makes the background of a button white (the buttonโs class is .button)โ, I would get a much more accurate response for my situation.โ
To Edwards, this exemplifies another important point about using these tools: You need to have coding experience and knowledge to get the most out of them. His example, he says, โshows how a person who does not code well would take longer and get less accurate responses.โ
Keep it simple
Peter Surowski, CTO of the web design and development agency Brain Jar, says he uses AI when heโs writing code, โbut itโs only useful for small tasks, ones that youโd normally use Google for. For example, if I need some boilerplate code just to set things up, ChatGPT is great for that. Or if you just canโt remember how to write a switch statement or a ternary function in whatever language, you can ask ChatGPT. But for anything more complicated, itโs useless. I think the people who were saying itโs going to take their jobs were being silly.โ
CodeSeeโs Leven says that โright now, ChatGPT is good at general code responses but not necessarily great at domain-specific code generation, scaffolding, and auto-complete. Itโs great at searching but at the same time itโs limited mostly because of the small context size.โ
Still, she says, โI expect this to improve over time. More value will come when it is possible to ask questions about a companyโs specific codebase and then have the AI perform the actual task for you. That will make AI truly game-changing.โ
Testing is a must
Most software shops have moved to a development regime where code needs to pass an extensive automated test suite before it goes into production. AI-generated code is no exception. While that may not be a drawback, per se, it may come as a disappointment to those with an unrealistic view of what the technology can achieve. โI have to review everything and of course test it,โ says Love2Devโs Love. โThere are too many developers that have historically taken what is on Stack Overflow and accepted it as the right answer; I am sure the same is happening with ChatGPT.โ
A little tidying is necessary
Almost nobody told us they were cutting and pasting AI-generated code without modification. โGenerally you have to make sure the code produced is correct and tested,โ says NetBeezโs Neophytou. โMost of the time it needs to be refined a littleโnot majorly re-written. But in some rare cases, the code it produces is exactly what you needed, and those times are just mind-blowing and very rewarding (and at the same time scary).โ
โUsually theyโll have to work some style guide stuff to make it match the codebase,โ says Rise8โs Wills. This work includes โrenaming methods, changing the format a little bit, and keeping everything clean and consistentโlike the codebase was written by one person.โ
Keep security in mind
Any new technique being used to write code is inevitably going to open up an attack surface to malicious actors in ways that are difficult to anticipate, and generative AI is no exception. In a recent example, security researchers found that ChatGPT hallucinations can include nonexistent npm packagesโand that an attacker could potentially predict those package names, create them, and fill them with malicious code.
Surya Sanchez, founder of DeepIdea Lab, which uses AI extensively as part of its workflow, says that the way to fight such attacks is to โrun the code locally, identify errors, and understand the AI-generated code is referring to non-existent packages. In those situations, we rewrite the code manually, providing clearer instructions to focus on particular sections instead of the entire code.โ Sanchez also advises that you โavoid sharing secrets or API keys, as AI could be reviewed by third parties. We want to ensure that sensitive information related to production remains secure.โ
In some ways, the current limitations of AI serve as a built-in security feature, at least for now. โThe token or prompt/response size limitations sort of give you a guard against malicious code in my opinion,โ says Love. โIt forces you to review everything in small chunks.โ
AI tools in schools and at work
As a teacher who works with computer programming students at the University of Amsterdam, Max van der Broek has a somewhat unique perspective on how up-and-coming programmers are thinking about AI. He recently conducted a survey that found that more than half of the students in his program were using ChatGPT for coding. (This is a higher percentage than those who use it for writing assignments.) One intriguing result from the survey is that the students want guidelines for ChatGPT use and find the current policy both unclear and too strict: They want some uses to be allowed, but not all. โI can imagine a future in which using generative AI is illegal in your first year as you learn the fundamentals, and itโs allowed as a copilot in later years as you create bigger and more complex projects,โ van der Broek says, adding that โthe best practices we have now will surely be outdated next year.โ
Developers in the workplace will also want to know how and when they can use AI on the job, so itโs imperative that managers start figuring out the rulesโbecause in all likelihood, some of them are doing it already. At Rise8, Wills says that use of AI was both a top-down and a bottom-up phenomenon. โBrian Kroger, our founder, was very interested,โ Wills says. โHe likes to stay abreast of whatโs the most current technology, so he was posing questions in our engineering channels to get us thinking about it. But at the same time we had people that, when ChatGPT really blew up, were immediately out there as early adopters and started using that resource to see what it was producing and how they could integrate it into their daily workflow.โ
Wills also says that Rise8 has budgeted money that developers can use to pay for tools they find helpful. Many have chosen to pay for access to ChatGPT-4, which he says produces better results than the free ChatGPT-3.5.
What does the future hold?
One of the biggest anxieties that generative AI has given rise to is that it will eliminate scores of human jobs that seemed safe from automationโcoding among them. While itโs impossible to say what the future holds, the developers and managers we spoke to were mostly skeptical. โIt can write chunks of code, and thatโs very impressive,โ says Brain Jarโs Surowski. โBut it canโt implement it, turn it into a plugin, test it, fix problems. Thatโs what a developer does. Weโre not just code writers. In fact, thatโs a fairly small part of our job. And itโs the only part AI can help with.โ
Overall, CodeSeeโs Leven agrees. โI do think that there will be companies that choose to reduce the size of their engineering teams,โ she says, but โforward-thinking, best-in-class companies will not do this. They will keep their place to outpace their competitors and win their space. The companies that do this will still need good developers because the truth is that the AI canโt reason, weigh trade-offs, or handle anything nonlinear or complex yetโso for now, its help is limited unless youโre building something simple. Weโve seen the best outcomes from a number of companies that use humans and AI together.โ


