Quick note before we dive in — I know I've been off track from the iOS/Swift series lately. I just have so many thoughts I need to get out of my head first. The series is coming back with the next article, I promise. Okay. Now. Story time.
I was thinking to tell you all about the afternoon I spent deleting code and accidentally learned more than I had in the entire month I spent generating it.
This is not the story I expected to be telling. I went in thinking I was doing a quick cleanup. I came out a different person. Slightly humbled, deeply caffeinated, and with 200 fewer lines of Swift in a file that somehow works better now. Let me explain.
The Part Where I Confess Something
A few weeks ago I was moving fast on a project. Like, embarrassingly fast. Generate, test, accept, move on. Generate, test, accept, move on. The AI was producing stuff that compiled and did the thing I asked and I was just... letting it. Not reading carefully. Not asking questions. Just vibing my way through feature after feature like someone who is definitely not going to regret this later.
Reader, I regretted it later.
Not because it broke. That's the genuinely annoying part — the code was fine. It ran. The features worked. Nobody was complaining. But every time I opened that file I got this low-level anxiety I couldn't quite name, like walking into a room you cleaned by shoving everything into the closet. Technically tidy. Spiritually wrong.
So one afternoon I just... started deleting things. No plan. Just me, a delete key, and a growing sense that I had accepted a lot of code I did not actually understand.
The First Thing That Happened Was I Got Scared
This surprised me. I'm not easily scared by code. But I kept hovering over things going "okay but what if this is the thing holding everything together and I just don't know it yet."
That feeling? That is the exact feeling I never have when I write code myself. When you write something, you carry the map in your head. You remember the night you added that defensive nil check because something exploded in testing. You remember why the function is structured the way it is because you restructured it twice. You have context.
With generated code, the code arrived and the context didn't come with it. The AI made decisions — some of them genuinely good decisions — and I accepted them without understanding why they were the decisions. So now I'm standing here six weeks later, looking at my own project like a stranger, trying to figure out which parts are load-bearing and which are just decoration.
This is exactly as uncomfortable as it sounds.
So I Started Making Predictions
Before I deleted anything, I started asking myself: okay, if I remove this, what do I think breaks? Not what could break in theory. What do I think will happen, specifically.
Some of my predictions were correct and deleting the thing confirmed it was redundant. Good. Simple.
Some of my predictions were wrong in interesting ways. There was a function I was absolutely certain was doing nothing useful — looked like a model just added it out of habit — and when I deleted it, a very specific edge case in a flow I'd half forgotten about quietly fell apart. Turns out the function was handling a nil that could only show up under a particular sequence of user actions I didn't immediately remember building.
That function taught me something I did not know I didn't know. Which is the most annoying kind of learning, but also the most useful.
The Final Score
200 lines gone. Some of it was genuinely redundant — duplicated logic, defensive checks for situations that couldn't actually happen, a helper function called exactly once that could have just been one line where it was used. The kind of thing that gets added by something being thorough, not by something that knows what your specific project actually needs.
Some of it I rewrote from scratch. Not because the original was wrong. Because rewriting it meant I finally owned it. There's a difference between code you're managing and code you understand, and I needed to close that gap before I could trust myself to work on it properly.
Some of it I kept exactly as it was. Because staring at the empty space after I tried to delete it made me realize it was doing something I actually needed, and I just hadn't been paying enough attention to appreciate it. Those were the most useful deletions of all, actually — the ones where I tried to get rid of something and the project said "no, you need that, let me show you why."
What I Learned That I Didn't Expect to Learn
Here's the thing nobody tells you about generating code quickly: the velocity is real but it has a price that doesn't show up on the day you shipped the feature. It shows up later. It shows up when you need to change something, or debug something weird, or explain the thing to someone else, or just open the file six weeks later and feel that closet-full-of-junk anxiety.
Every line you accept without understanding is a small loan. The interest compounds quietly until you need to touch the thing again.
Deleting code — actually reading it carefully enough to have an opinion about whether it should exist — is one of the weirdest and most effective ways to pay that debt down. You can't delete something without understanding it well enough to argue for or against it. Which means by the time you're done, you've been forced to actually learn the codebase you thought you already knew.
I came in for a cleanup. I got an education. Slightly against my will, but still.
The Part Where I Tell You What I'm Actually Doing Differently Now
I haven't stopped using AI to generate code. That would be a dramatic overreaction and also I have deadlines. But I've started treating accepted suggestions like debt I'm choosing to take on, not like code I wrote. Because the moment I need to touch it again, I need to understand it — and if I never read it carefully, that understanding isn't there just because I was in the room when it was generated.
So now, every once in a while, I open a file I generated fast and haven't looked at closely since. I read it like it's someone else's code. I try to delete things. I make predictions about what I think will break, and then I see if I'm right.
Sometimes I am. Sometimes I'm wrong in exactly the ways that teach me something.
Either way, I come out knowing the codebase better than I did going in.
Which is, genuinely, more than I can say for the afternoon I generated it.
AI tools were used to help with grammar and structure.
Top comments (0)