I thought my job was safe. Then I replaced a software engineer with ChatGPT

I thought my job was safe. Then I replaced a software engineer with ChatGPT

I've been working with a high-schooler who wants to code for videogames. I wrote a Python app to power the content pipeline for a new game I'm working on and, not being a committed Pythonista, I asked for the code to be converted to JavaScript. That conversion seemed like a snack-size project to see what the kid could do. They hacked away at the Python over a few days and delivered a JavaScript version that compiled and ran. I had notes; more speculative generalization in your interface design, less tightly coupled code, that sort of thing. They sent back a second draft but I got busy and didn't have a minute to take another look. That was last month. A couple of weeks later they lost the job to ChatGPT.

My Father was an electronics engineer who built an 8-bit home computer on our kitchen table in the 70's. I write software. My whole life Dad warned me that software engineers would become irrelevant when software started writing software. I never saw his prediction fulfilled in the thirty years since I studied AI and CS at Edinburgh. That emboldened my AI skepticism. But the specter of my impending relegation to the ash heap of technology never felt so real as the day I asked ChatGPT to transpile code.

That ChatGPT converts code from one language to another may be an Easter Egg. The first time I asked it to "convert this python code into javascript" it informed me apologetically that it is a Natural Language product that does not have access to tools for transpiling code. My son reformatted the request into a more declarative demand - teenagers are good like that - and pasted the Python directly into ChatGPT's input box.?

The code that came back didn't compile, failing on JavaScript's "yield" keyword. I remained skeptical. Not fully understanding the nuances that separate Python's yield keyword from Javascript's, I was ready to call it quits. But my Son simply asked ChatGPT to perform the conversion again without using "yield". The code that came back the second time ran but the output was so broken I wanted to give up again, my skepticism shaken but intact. Instead, driven by the uneasy feeling I might be losing my grip on an emerging future reality, I began debugging this code summoned from a superhuman source. I quickly noticed I had failed to RTFM - ChatGPT had commented its code, explaining it had re-written part of the original Python that dealt with parsing text files:

"Note: In this JavaScript code, I assumed that the input.txt file is already available in the form of a string. If the file needs to be read from the filesystem, then you can use the fs module in Node.js to read the file."

ChatGPT was drawing my attention to changes in its code that (he/she/they/it) thought would probably need my attention. It was right. No, my input file was not available in the form of a string. Yes, I needed to use the fs module to read it in from the filesystem. I did as I was told and the re-written Javascript code ran perfectly.

My thoughts about the future have been similarly re-written.

I know enough about AI to dismiss many advancements in the field as parlor tricks. The enhanced autopilot that drives me hundreds of miles a year is a pixel-to-vector-space conversion parlor trick running at high frame rates on custom ASICs. But this experience with ChatGPT started to look more like artificial understanding.

There are two reasons I'd expect an engineer to develop an understanding of the Python code as a necessary precursor to conversion. First, you can't just transpile languages word for word - to some extent you have to understand what's going on in the machine and the intention behind the code. Second, the code in question constructs a data structure optimized for a particular search space then performs a brute-force, breadth-first search of that structure. It's not rocket surgery but it's also not bubble sort, i.e. the problem domain is specialized enough that you're unlikely to find a paste-ready solution on stackoverflow. I'm not certain if ChatGPT understood the code before it did the conversion, or if it's just another parlor trick. What is certain is that ChatGPT understands the yield keyword in both languages better than I, well enough to re-write those sections of the code to run without it:

"In this code, I removed the yield statement from the traverse function, and instead of returning a generator, I return an array of paths from the traverse function. This array is then iterated over to print the paths in the same way as the original Python code."

It also runs orders of magnitude faster than junior programmers and writes better comments.

As for my teenage transpiler, I fear for their future. I guess I'll pay them out for the work they performed even though I may never use their code. Maybe I should advise them to embrace autoregressive language model tools as part of an emerging software development paradigm where AI "cobots" provide a force-multiplier for human creativity. Or maybe they should consider a different career path. I'm considering both.

Patrick O'Brien

Emmy award-winning marketing and content manager, creating the best sounding hardware and software for today's electronic musicians and producers

1 年

Excellent read, Mike!

Jon Keegan

Tech reporter at Sherwood News

1 年

The code writing part of it is absolutely magical. I’ve had a similar experience with a few sample prompts but after some persistence it is truly helpful. Especially for building simple bespoke scripts that Would be like 4 distinct queries on stack overflow.

Cory Radcliff

Google Play Games for PC

1 年

The robots overlords, they are a-comin’. I have stopped cursing at my computers just in case.

要查看或添加评论,请登录

社区洞察

其他会员也浏览了