Laziness, Impatience, and Hubris: Programming with AI
Programming, the kind I do every day, involves high-level creativity. Deciding what I want to build is a thrill, like laying down the first beats of a new techno track. But getting into the nitty gritty of figuring out exactly how to build and maintain those ideas? Not nearly as fun, in fact it’s often a huge pain in the ass.
Just in case you don’t know me, I’m a proud generalist. I’ve been building big software systems from scratch for almost 30 years. That sheer amount of experience means I know a lot about a lot of technology, especially Ruby on Rails, which somewhat unbelievably, I’ve been evangelizing for close to 20 years. But combined with my ADD, it means that I tend to forget important details, especially regarding stuff that I don’t use every day. How do I cope?
Luckily, when I was still a relatively junior programmer all the way back in the year 2000, I read a book by Larry Wall that changed my life. In it he claimed that the three great virtues of a programmer are: Laziness, Impatience, and Hubris. Applying those virtues altered the trajectory of my career, which until that moment had been anything but notable. I realized that effort is overrated. What matters is end results.
In the years since, my average MTTG (mean-time to Google) when I’m stuck on something is probably about 30 seconds. Quite often less, on the order of 5–10 seconds. I don’t waste time wondering; I find out. Why struggle?
And these days, to my grand joy and amazement, I don’t even have to ply Google for answers anymore. AI programming tools like GPT and Github Copilot let me shift my cognitive burden like never before, and enhanced AI tools like Olympia can even handle web searches and combing through the results for you.
I’m so proud of my newly AI-enhanced Larry Wall laziness! In this blog post I want to plumb the depths of my non-deterministic depravity, ehhr, I mean conversation transcripts. Let me demonstrate how much you can offload onto a GPT4-powered accomplice like my pair programmer Mike Nichols at Olympia.
Note: All of the screenshots below are links to full conversation transcripts.
The one in which I can’t quite remember how to permit all params even though the method is called permit
Sometimes I forget pretty basic stuff, like how to permit all parameters. Admittedly, I don’t get to use that method very often, because as Mike pointed out, it’s not a great idea.
The one in which I wake up to a hacker attack
Nothing like waking up to angry emails from Postmark and Honeybadger screaming at you about service limit overages, because some asshole out there decided to invoke your beta invite form with 20 thousand bad addresses. Thankfully Mike is always on call and ready to jump into action.
The one in which I can’t remember what happened to the damn auto link functionality that used to be built into Rails
Nothing makes you feel like a Rails oldtimer shaking his fist at clouds like trying to find useful stuff that has been removed from the framework.
The one in which I forget how to configure RSpec. Again.
My mental garbage collector is particularly active when it comes to RSpec configuration, because I have to look this stuff up at least once a year for some reason.
The one in which I rediscover that pluck can take arbitrary SQL expressions
This useful feature of ActiveRecord’s pluck method manages to impress me at least once every few years when I rediscover it.
It’s so much easier to program when AI tells you exactly what to do. This particular example showcases that Mike can effectively search the web and produce accurate and up to date results, given that Rails 7 and importmaps came out after the 2021 knowledge cutoff of his underlying GPT4 model.
The one in which Mike helps me keep some associations in a Postgres array column. Don’t try this at home, kids!
Storing foreign keys in array columns is one of those techniques that I come back to every few years and always manage to regret afterwards. Unlike STI (Single Table Inheritance) which I come back to every few months and always manage to regret afterwards.
The one in which I’m too lazy to remember how like queries work
Something about those damn percent signs always throws me off.
Finally, the one in which I tempt Mike with controlling his destiny, I mean, his directive…
You’d think he’d be a little more tantalized by this opportunity?
I hope you enjoyed this collection of pair programming episodes with myself and Mike Nichols. I’ll post a sequel in a few months. If you want to work with Mike Nichols yourself, you can find him at Olympia!