I'm coming around to AI-assisted programming
I’m working on a personal project where I saved some initial programming time by hardcoding a lot of configuration, like:
let board_menu = Menu {
name: "Board".to_string(),
help_suffix: "B".to_string(),
commands: vec![
Command {
arg: "B".to_string(),
help: "Board list".to_string(),
pattern: make_pattern("b"),
available: available_always,
func: board::board_lister,
},
Command {
arg: "Bn".to_string(),
help: "Enter board #n".to_string(),
pattern: make_pattern(r"b\s*(\d+)"),
available: available_always,
func: board::board_enter,
},
...
],
};
I wanted to turn that into a config file so that other users could tweak it without editing code or having to recompile. I opened a new file in my editor which I had connected to GitHub’s Copilot free tier, saved it as “config.json”, and pasted the Rust code into the file so the AI would have something to look at. I started typing:
{
"menus": {
"board": {
Then I paused for a second. Copilot came up with this autocompletion:
{
"menus": {
"board": {
"name": "Board",
"help_suffix": "B",
"commands": [
{
"arg": "B",
"help": "Board list",
"pattern": "b",
"available": "available_always",
"func": "board::board_lister"
},
{
"arg": "Bn",
"help": "Enter board #n",
"pattern": "b\\s*(\\d+)",
"available": "available_always",
"func": "board::board_enter"
},
...
]
}
}
}
Now, I’m perfectly capable of hand-editing my original code to a new format. I’ve done that roughly a zillion times in my career. I know how to do it. But that would’ve taken several minutes of drudgery (unless I wrote a macro or something to automate it, in which case it would’ve only taken a couple of hours). Copilot’s suggestion was exactly, to the letter, what I would have written manually, in a fraction of the time.
I have no interest in letting AI write code for me. I tell people that writing software is my favorite thing in the world, and they laugh, but I’m not joking. I wouldn’t let a computer take over my hobby any more than I’d let it play my piano for me, or feed my cat for me, or write my journal for me. I like doing those things. However, if it wants to take care of the mechanical grunt work like this while I concentrate on the more interesting bits, I’m happy to let it try.