Thinking about Programming with AI

Programming is the killer app of modern generative AI; programmers have found generative AI to be extremely useful and frequently use it to improve their productivity. Notice: they use it to improve their productivity, not to replace them as programmers. Why is that? If AI can program, why don’t we just replace programmers with AI? If AI can’t program, then how do programmers use it to increase their productivity? The answers to these questions is all about how programmers use AI. When used poorly, AI can replace programmers, but the resulting code isn’t very good and often not that useful. When used well, AI helps augment and support and speed up programming tasks, but the programmer still has important and vital roles to play.

For the purposes of this article, when I refer to AI, I am referring to Large Language Models (LLMs) like Anthropic’s Claude, Google’s Gemini, or OpenAI’s ChatGPT / Codex.

Key idea: Pair Programming

To think about how to use AI for programming, it helps to go back to an older idea: pair programming. Pair programming is an older idea of how to do programming where two people (humans) work together to create a programming. The key idea behind pair programming is summed up in the phrase “Two people, one computer”. Two humans sit in front of a single computer and work on a program together. They divide up the work: one person is the driver, whose hands are on the keyboard physically typing code into the editor and running the program. The other person is the navigator, watching over the shoulder, providing advice and thinking ahead about the program.

The driver focuses on the nitty-gritty details of the program – what should this variable be called? is a semicolon needed here? what are the right parameters for this function? The navigator, by virtue of not having to worry about the details, is able to think about bigger issues: does this function even make sense, or would an alternative design work better? is there a consistent naming scheme for these variables that we are using, and does this variable follow it?

Pair programming works well for humans working together, and often actually enables better productivity than having the two programmers work separately. However, it is also a great metaphor for working with AI. You can think of programming with AI like working with a pair programmer: you and the AI are a pair working on the same computer to write a single program together. But then the obvious question: should the AI be the driver or the navigator? And does the driver/navigator breakdown still make sense?

Another key idea: Reverse Centaurs

Cory Doctorow, the science fiction author, has a useful way of thinking about the role of AI in a human/AI pairing. He draws on the Greek myth of the centaur, a half-human half-horse hybrid. Doctorow claims that a human is acting as a centaur when they are assisted by a machine AI, and that machine does some onerous but boring/easy task instead of having the human do it – the human half includes the brain, and the horse/AI half is the workhorse. But then he goes on to claim that the reverse is equally possible. A reverse centaur happens when a machine is assisted by a human being, but the machine is the “brain” that makes all of the important decisions, but the human is expected to keep up with the AI (and, often, take responsibility or blame for what the AI produces).

This is a subtle but important distinction; in both cases, the human and AI work together, but for a centaur, the human is in charge and works at a human pace, with AI assistance. For a reverse centaur, the AI is in charge and making all the decisions, and the human struggles to keep up, though is held responsible for all the faults of the AI.

This can help us figure out how to use AI as a partner: ideally, we want to partner with AI as a centaur, with us in control, but not as a reverse centaur, where it does all the work faster than we can keep up, and we take all the blame.

Ways of Programming with AI

There are many different ways that programmers have experimented with using AI to help them program. Here are a couple of different ways, along some thoughts about what works or doesn’t work about them.

AI as a search engine (aka the “Chat interface”)

This is the way that most people start programming with AI assistance.

When programming, there are all kinds of details that you don’t really remember, so you start by searching (“Googling”) for the details that you don’t remember. For example you may remember “I know there is a function that to substitute one word with another in a string, but I don’t remember what it is, or the exact syntax for using it”. So you go to Google, type in a brief query, and it brings up a webpage of documentation about that function.

The first way to use AI is basically the same. When you need some details for your programming, you open up your AI chat interface and ask it for details. It can easily provide details and examples for almost all APIs that are publicly documented and existed before the training of the model; and most of them can also search the internet for publicly available docuemntation for updated APIs and newer APIs. If the API documentation isn’t publicly available, the generic models often can’t answer the question, but it is possible to augment AIs with additional private inforamtion – many companies have their own AI models augmented with their internal documentation.

Once you do that, you’ll notice that you can often ask more complicated queries that involve not just providing a function name or documentation details, but asking the AI to write whole functions. For example, you might say “Write me a function that uses the standard python API to find and return a list of all of locations of a given letter in a string.”

Using AI this way basically replaces Google with AI, a slightly more functional version of Google. The AI is good at writing nice, self-contained functions or small bits of code to do something. But it doens’t integrate well with larger projects or codebases. It still requires the programmer to do almost all of the thinking (i.e. act as a centaur), and treats the AI as a navigator that is really knowledgable, but not very helpful.

Agentic AI (aka “Vibe Coding”)

AI can do a lot more than search, though. It can act as an agent: it can make decisions and actually create files and run programs on your computer. Most programmers first interact with agentic AI through one of the programming harnesses, such as the command line interface for Gemini or Claude Code or OpenAI Codex. These harnesses give the AI the ability not to just write code, but to read your existing code, understand it, and write new code or make changes to your code that you ask.

For example, you can open up the Gemini command-line interface and ask Gemini to “write me a tic-tac-toe program”, and it will do so. The whole program, in its own file. You can even give it guidance as to how – “write it in python using a turtle graphics based interface”.

OR, if you already have a program, you can open up the command-line interface and ask it to make changes to your program. You an ask it to “handle errors when the user enters something that isn’t a number” or “add a new button that switches between dark mode and light mode when pressed”, and the AI will go and add code to do that.

This is pretty amazing; you don’t have to be a programmer to use an AI this way. And even if you are, you don’t even need to look at the code that the AI writes. You can just ask it to write things, ask it to make changes, and run it to see what happens. This is known as “vibe coding”.

However, you have very little control over how the program gets written. Yes, the program gets written, and it works for surprisingly complex programs. But the code that gets written is likely to have lots of bugs in it – little places that work for normal situations but fail in weird ways. It is likely to have a lot of security vulnerabilities – AI is notorious for leaving security problems everywhere. And over time, your vibe-coded program gets more and more complicated and complex, making it increasingly difficult for you (or any human) to read the code and understand what it is doing. It even happens that it gets so complicated that the AI can’t really understand what the code does, and starts making even more mistakes.

Additionally, programming is very much a creative endeavor, and a lot of programming injects human creativity into the code to do things in interesting and valuable ways. AI is particularly bad at this aspect, and makes lots of weird choices in places where human creativity can flourish. Asking it to create interfaces or draw graphics often leads to very weird looks and feels.

Vibe coding like this is clearly leaving AI in the driver’s seat, with you (the human programmer) relegated to being a distant navigator. This is also the poster child for the reverse centaur idea: the AI is making lots of programming decisions, but the human is expected to check over the AI’s code to make sure it doesn’t have bugs or security vulnerabilities. The human, not the AI, is the one that gets fired when the code has too many bugs, but the AI’s code gets complex fast and is almost impossible for a human to read or understand. The tech industry currently has many stories about programmers who previously wrote high-quality bug-free code getting fired when they started asking AI to do too much of the programming for them.

Fancy Autocomplete

If AI-as-search and vibe coding are two extremes, is there a way of using AI somewhere in the middle, that works better? Once place to start is to look at IDEs like Visual Studio Code. Code integrates AI into its autocomplete interface. Rather than just suggesting names of functions, Code’s autocomplete can suggest whole function calls (including what parameters you might want), and it can even autocomplete whole functions.

IDE-integrated autocomplete as a reasonable attempt to find a middle ground. It reads your existing code and integrates with it better than a chat/search interface can. But it still leaves the programmer driving and leading the majority of the code writing, mostly acting as a fast navigator. The code that is written is mostly human-readable – because the programmer needs to accept the code and can modify it as it is being written. It also leaves the human-AI relationship clearly in the centaur mode, with the human driving what code is written or accepted.

The main weakness of using AI as a fancy autocomplete is that it is slow. It isn’t slow because the AI is slow; it is slow because it only works at the speed the human is working. Most humans work faster with autocomplete, but the speed is still limited by how fast you, the human programmer, can come up with what needs to be written and can start writing it. Most of the major design decisions and code architecture are still clearly being driven by the programmer. Programmers can’t use this model to write anything new that they couldn’t already create. It just speeds up the typing, mostly.

Working this way can be seen like offloading some of the minor technical work – the typing in the code, the looking up parameters, etc. – to a lower-level, less-experiences programmer while you (the more skilled programmer) focuses on higher level ideas. It is just that the lower-level programmer works a lot faster than you do.

Separating Structure from Details (aka AI as Driver)

If we conceptualize splitting up the work into lower-level work (typing in the code) from the higher-level work (defining functions, etc.), we can extend that metaphor even more to try to move more of the work to the AI.

Most modern programmers use a lot more tools than just text files of code; they will create architecture diagrams and lists of features, and maps of function relationships, etc. Much of this exists mainly on the whiteboards in programmers offices, but it is also often formalized into design documentation, team architecture documents, etc. In many programmer teams, a “senior” programmer leads the design and architecture work while more “junior” programmers do a lot of the implementation, testing, and bugfixing.

One way that people are using AI for programming is to give themselves the “senior” role, and leaving AI to take the “junior” roles. To do that, the human programmer needs to spend more of their time thinking about and documenting the higher-level code design decisions – code architecture, function relationships, desired functionality and use cases, etc. The human writes these down explicitly – either as “AI prompts” or, more likely, as supporting documentation. Then the human asks the AI to try to implement these one feature at a time, and can check on the output. Well-designed programs (e.g. code that starts with a Minimum Viable Product – an MVP – and builds out features one at a time) can use this model. Much of the actual implementation can be offloaded to the AI, letting the AI drive much of the work.

This model of programming uses AI as a driver, which an greatly speed up implementation. But it requires a lot of up-front work from the humant to think about and document the architecture. Much of this work needs to be done anyway, and many teams do this work up front (before programming starts) already, so it doesn’t save on that work, it can save a lot of time on the actual implemention once this work is complete.

There are two downsides to this. One, it basically embeds a waterfall model of software development into the relationship with the AI, assuming that the human can come up with good architecture and design ideas before any code is written. That just isn’t how human brains work, and often it is the back-and-forth trying to write a program that leads to better design and architecture ideas. (This happens when teams assign implemention to junior (human) programmers too.) Second, while it isn’t automatically a reverse centaur where the programmer is responsible for code it didn’t write or understand, it very easily slips into a reverse centaur situation. While AI implementions are much higher quality when done with the additional context of a coherent and sensible high-level design, it still runs the risk of plausible code creating bugs and vulnerabilities that the human can’t understand.

Using AI as a Navigator

If we think of the human-AI team as a pair programming team, almost all of the above strategies seek to use the AI as a driver – primarily to speed up the actual writing of the code. But in real software development, most of the time isn’t spent typing; it is spent finding and fixing bugs, thinking about code architecture, refactoring existing code based on new thinking, etc. Much of that work can’t really be outsourced to an AI – but an AI can help with it, if we just reverse the team.

Rather than having the AI act as a driver, what would happen if the AI acted as the navigator in the pair programming team? It is reasonable to prompt the AI to watch the programming as the human works, and think about higher-level issues. Ask the AI to bring suggestions – is there a better way to organize these functions? what kinds of tests should we be thinking about to catch weird problems? are there libraries that already implement parts of what I’m trying to do?

Using the AI as a navigator instead of a driver focuses the AI’s efforts on the higher-level problems that end up taking the most programmer time – finding problems, redesigning and refactoring code, and getting outside thoughts about what you are working on. The prompts are less straightforward, but AI has a lot of ability to read and think about code and provide advice, and searching online it is possible to find good “navigator” prompts.

When effective, this strategy – using the AI as navigator, while the human is a driver writing the code – has the potential to speed up programming tasks by saving a lot of time on the high-level decision-making and architecture and bug-finding, which are much bigger sinks of programmer time than the actual typing of code. So, it can significantly speed up programming, though for more straightforward programing tasks (where the high-level problem-solving thinking isn’t as important), it won’t help as much.

This strategy also leave the human firmly acting as centaur, taking responsibility for the code and all of the decisions made along the way. As navigator, it can help identify bugs and vulnerabilities, but it is still the responsibility of the human to fix them. However, it might not lead to as much efficiency improvements as letting the AI drive.

So What Should I Do?

There is no straightforward way to answer this question. There are lots of ways to think about how to use AI in programming, and new ones are being invented every day. Most programmers end up using some form of hybrid of the above approaches, asking the AI to drive and write some code, but also using autocomplete or navigator help for others, and also using chat/search interfaces for advice.

Personally, I find it to be extremely important to work as a centaur, and take responsibility for my programs. This means both writing programs that I try my best to be bug (and vulnerability) free, and also writing code that is human-readable and human-maintainable. To do that, I mostly use AI as a navigator, with a complex set of prompts that mostly look at my code and provide advice about error checking, code architecture, library use, and bug finding. I also use AI-as-autocomplete a lot, as it speeds up my typing significantly without me losing control/responsibility.

Finally, while I do use some AI-as-driver (or vibe coding), but only on things that I think are fairly straightward to implement, and still even then, not as much as I thought. I’ve found that when AI is good at writing some code, it is likely because others have already written it really well, so it is better to ask the AI for a library or API I can use, which I prefer because libraries and APIs are kept up-to-date with bug fixes and security vulnerabilities. If I have AI write the code, the I am responsible for making sure any bugs or vulnerabilities are found and fixed.


This site uses Just the Docs, a documentation theme for Jekyll.