I may be wrong here, but I think the way to think about using AI for programming is to treat it as the junior programmer you’ve taken under your wing. You give it jobs to do, then have to scrutinise what it did to check it did what you meant. If it does something dumb, you let it know so that it doesn’t do that again, though for an AI this is less a case of gently pointing out the error and more of adjusting your standing instructions in some way. The same if it does something too clever (and I know people who need to be reminded regularly that there is such a thing as “too clever”). There are additional considerations when you are a consultant — in particular some clients do not want AIs involved in their development work for a variety of reasons — but in general the analogy seems to work.
I would guess from some of the more despairing posts that have cropped up on LinkedIn over the last year that some people would have a problem with this approach. AIs generate code so fast, they wail, you cannot possibly keep up with the reviews. That’s true and a problem for open projects, but you control how much code your junior writes. An AI won’t fret if it isn’t given work, so you can take the time to review what it does.
It’s worth digressing into what code reviews are meant to do. They aren’t bug-hunting exercises, that’s the first thing to say. A review may catch bugs, but most of what it should be concerned about is structure. Does the code look sound? Does it fit into the structure of the existing project? Does it unnecessarily reinvent the wheel? Has it made any unjustifiable assumptions? The very first code review I did on my own, many years ago now, involved functions to connect and disconnect data channels in a device. It turned out that the programmer had just assumed from the example in the feature request that channels would be disconnected in the reverse order to their connection. My job as reviewer was to notice that there were no guarantees about the order of connection and disconnection whatsoever, and if a user strayed from the One True Path hilarity would ensue. I didn’t need to go down to the depths of exactly what hilarity would ensue (though in my youthful enthusiasm I did), just that the assumption was unjustified. That assumption made the whole code structure unsound.
As the senior programmer to your slightly hyper junior programmer AI, it’s your job to do the same things. You check its output exactly as you would for a human junior; does what it has written do what you asked for, or better what you wanted, does it fit into the project, does it offer an opening for bugs and misunderstandings, does it commit the faults you know it is prone to? It’s less a matter of trying to achieve perfection and more not storing up trouble for the future. This is important to you, or at least it should be. It’s your reputation on the line if the code turns out to be problematic or ugly; “Oh, the AI got it wrong” is not a good excuse when it’s your name on the commit.
(Reputation is, incidentally, part of the solution to the open software problem of being flooded with AI-generated pull requests. If you get a reputation for spamming, for example, chances are project leads will skip over your PRs in favour of people who have demonstrated they make more thoughtful submissions. By all means make a name for yourself, just be careful what that name stands for in other people’s eyes.)
I can imagine that this approach would leave many champing at the bit. We’re not getting the full benefit of AI, they might argue, if you spend hours reviewing code it spent minutes generating. If the code is something you would be happy to let a junior do unsupervised, they may have a point. I probably wouldn’t spend more than a few minutes looking over code for something unimportant or very self-contained, or genuinely throwaway. If it’s more than that, you would be setting yourself up for failure. Many US lawyers learned that the hard way, treating their AI as a paralegal but not checking what it produced, and being publicly embarrassed when it turned out their AI had hallucinated cases. AI output has improved considerably since then, but these issues do still seem to arise (believe it or not, Claude was the one to point out that courts were still sanctioning lawyers over invented citations throughout last year, and not just in the US. It was right; I checked). You need to put the work in to make sure that what your assistant has produced is both what you needed and correct.
There is a great gaping hole in this approach for many industries that needs more consideration than it seems to be getting: what do you do with your actual juniors? If you are giving all the jobs you used to give to them to AIs instead, how will they become the seniors capable of getting good results from AIs? This applies to all sectors that are getting AI to do the scutwork they used to train people with; I’ve certainly heard it from the financial sector, and I’d be surprised if it didn’t crop up elsewhere. Some industry leaders have spoken up about this, and some studies have shown worrying trends, but no one seems to have a solution, or at least not one they have publicised. Companies that don’t address it will find that they don’t have engineers, financial analysts or whatever in a decade or so. I worry that many companies haven’t recognised that succession is a problem. Succession training is now more important than it used to be because the easy paths are gone. This begs the question of what skills the successors of today’s senior engineers will need, but that’s a large enough subject to deserve an article of its own.
These are my opinions, of course, and I’d be interested in hearing alternatives. In particular, how do we solve the problem of succession? Has anyone come up with any solutions that I just haven’t heard about? What conclusions, if any, have you come to?
