“It felt like magic to me,” says Pietro Schirano. “It scared me a little bit because it was so good.”
He’s talking about the latest version of ChatGPT, an artificial intelligence (AI) tool. You type something in, and it makes up a reply for you.
It’s uncanny how human, friendly and intelligent the responses seem. Underneath it is an AI model called GPT-4.
Mr Schirano, design lead at business finance company Brex, has been using ChatGPT to make computer programs.
“I want to build a Pong-like game,” he typed, referencing Atari’s table tennis game of the 1970s. “What’s the best language to [use] so that lots of people can try?”
What would have taken an experienced developer half an hour to write took ChatGPT 40 seconds. It worked equally well for classic arcade games Breakout and Asteroids.
There are lots of code examples for these games online, but ChatGPT isn’t searching the internet for a ready-made answer.
Although it’s been built using huge amounts of web content, ChatGPT generates new text just for you by predicting the right answer.
“ChatGPT was able to understand my question about how I make this game more popular,” says Mr Schirano. “It has a lot of contextual understanding that somebody who’s never developed couldn’t get from Google.”
Using a search engine, you’d have to figure out which coding language to use, how to use it, and how to finish any incomplete examples online. ChatGPT can give you all the game code, together with instructions tailored to your needs.
“Now, even somebody who has no idea of what they’re doing can create a simple web app,” says Mr Schirano.
Some say that recreating these old games was too easy because there are so many examples online.
So Mr Schirano’s colleague Ammaar Reshi, design manager at Brex, pushed ChatGPT further. He asked it to recreate an old PC game for which there is no example code online. It’s a 3D game called Skyroads where you guide a car along a road, jumping over barriers.
ChatGPT knew about the game from its Wikipedia page and Mr Reshi elaborated on how the game works. “There was so much back and forth with this one,” says Mr Reshi. “Literally an hour of tweak this, tweak that.” He had to test the game, tell ChatGPT how to change the game behaviour, and repeat.
These are small games, and nobody’s suggesting ChatGPT will be making modern console games. But it could be used to make parts of a major game, or to help create any other software.
But even with the productivity improvements, some hesitate to adopt AI for coding.
“The risks of ChatGPT for software development still outweigh the benefits,” says Tony Smith, chief technology officer at Rightly, an organisation that helps people get their data deleted from company databases. “The code these AIs generate is often flawed or inefficient.”
Mr Smith asked ChatGPT to create some code to work out how many days are in a given month. “The code looks great, however there’s a problem with the shift to British Summer Time, so it thinks March has 30 days,” he says. “There’s a subtle bug that will show up once a year.”
Others have found that AI-generated code can include security flaws. ChatGPT may model bad behaviour it’s seen online, overlook vulnerabilities or use outdated techniques. Also, ChatGPT has limited knowledge of events after 2021.
The Italian data-protection authority has blocked ChatGPT while it investigates whether it complied with General Data Protection Regulation.
Business risk increases, too, if people are tempted to use code they don’t understand.
Kevin Bocek is vice president, security strategy and threat intelligence, at Venafi, a company that makes security software for authenticating machines. He used ChatGPT to create Excel macros and PowerShell scripts, which are two different ways to give a computer repeatable instructions. Hackers often use them to launch an attack.
“Now I’ve got code that’s come from ‘out there’ and I’m going to run it, and I’ve got no idea what it does,” he says. “The opportunity has now increased for more code to come in that might be harmful.”
While AI can be used to create code, it will always be the developer’s responsibility to check it at Venafi. “That’s something we take very seriously,” he says. “Code is reviewed multiple times by humans. Ultimately, it’s the professional developers that are responsible and accountable.”
He’s concerned, though, that ChatGPT could take away some of the satisfying work, too. “Part of the joy of developing is learning exactly what a file does and how it all works,” he says. “If ChatGPT is doing this for us, we aren’t really growing as developers.”
Dan Ciruli, vice president of technology at cloud management company D2iQ, has a different take. He previously worked at Google.
Google’s application programming interfaces (APIs) enable developers to connect their software to Google services. There were 200 APIs and seven supported programming languages, including Python. To provide instructions for every API in each language, Google would have to create 1,400 code examples.
“That’s something we struggled with,” he says. “We just couldn’t create samples in every [programming] language. But when I got access to ChatGPT, the first thing I did was ask it to show me how to call the Google Translate API in Python. Boom – there it was.”
The future of software development is likely to be a partnership between the developer and the AI assistant, which is reflected in the name of one popular AI tool. GitHub Copilot is a commercial tool that automatically completes code as developers work. The code completion uses a faster but less accurate model than ChatGPT.
“Given you’re typing code, ideally every time you input a character, you get a new response,” says GitHub CEO Thomas Dohmke.
Although Copilot has been upgraded with features to detect and block insecure code, humans remain an essential safeguard. “Like any other coding tool, you should always use GitHub Copilot together with human code review, testing practices and security tools,” says Mr Dohmke.
Will AI code generation lead to job losses? Mr Schirano and Mr Reshi can both foresee that junior roles could be replaced if AI takes on repetitive coding work.
Manuel Doc is a front-end developer at user experience agency Illustrate Digital. “I was so amazed by ChatGPT’s code-level responses that I was scared my job would be in jeopardy soon,” he says.
“However, during my 1-2-1 with our head developer, he helped me understand that I’m not just hired to write code, but to analyse problems and provide solutions that ChatGPT can’t give. It was very reassuring.”
By Sean McManus
Technology Reporter (BBC NEWS)