GitHub Copilot: Thoughts on an Alternative Workflow

12th May 2023

A cow facing the camera with the sky and clouds in the background

Knock knock!
Who's there?
The interrupting cow.
The interrupting cow wh...
MOO!

Using Github Copilot has been compared to pair programming, but if anyone ever acted the way Copilot does, then I would politely decline any invitation to pair with them in the future.

I haven't done a great deal of pair programming in the past, so maybe I'm doing it wrong, but it usually goes something like this; first we have a brief discussion of what we're trying to do, as well as some initial ideas of how we're going to tackle the problem. Once that's done I'll start writing some code with my partner metaphorically (I've only ever paired remotely) looking over my shoulder. As we go along they'll point out any mistakes they notice and we'll chat about any thoughts as we go and hopefully arrive at a solid end product, a combination of the knowledge and experience of both developers.

That description mostly matches the process of using Copilot, just without the manners or knowledge of conversational etiquette.

Instead, there's no upfront discussion, save the times when I create a class or name a method and Copilot takes that as a cue to write the whole thing for me. I then have to switch mind-set from coding to reviewing as I look through what it has generated.

If, on the other hand, it decides to keep its thoughts to itself until I'm half what through the implementation, that's when we end up with a re-enactment of the playground joke at the top. As I'm part-way through typing something it can't help but blurt out "do it like this!". My stream of thought is interrupted and I again have to make the switch from coding to reviewing.

The implementations that Copilot suggests usually fall into one of two buckets; almost exactly what I'm looking for and just needing a couple of small tweaks, or completely missing the point and giving me something totally irrelevant. Unfortunately both these situations call for that same switch to reviewing, interrupting the train of thought on what needs to be done.

What may be preferable would be a keyboard shortcut for "please review this code". This would prompt Copilot to point out any mistakes and suggest alternative implementations of any new or amended code (based on a diff). This would inevitably mean writing more myself, but it would ensure I only get input at the point I'm poised to receive it. No more interrup...

MOO!