Latest
Anthropic Bans Cruelty Toward Claude: What It Means for WritersWork-for-Hire Contracts: What the Asimov’s Cover Fight Teaches FreelancersGenre Fiction vs Literary Fiction: Don’t Confuse Taste With SkillFlorida Hurricane Prep Rituals: The Grocery Run, the Water Pallet and the Generator in the BoxThe Most Insulting Line of Dialogue Ever Written for the ScreenLoki Through the Ages: From Norse Myth to Marvel, The Mask and Dogma“You Are Utterly Disgusting”: A Book Festival, an AI Cover Ban and a Pile-OnWho Rewrote the Sligachan Legend: AI or the Tour Buses?Why I Don’t Like Reedsy for Ghostwriting: The NDA ProblemLayers: How I Ride Out Florida Power Outages in My ApartmentThe Enshittification of AmazonPublishers Cancel Books Over AI While Using It in SecretI Was Getting 100 Spam Emails a Day. $4.50 a Month Fixed It.World Mental Health Day: Nothing Was Wrong With MeKessler Syndrome: How Space Debris Could Close Earth’s OrbitAmazon Is Blocking Real Readers From Book ReviewsShould a Novella Get a Paperback, or Go Ebook Only?BookFunnel Download Problems: Fixes, Scams and AlternativesSir Sean Connery: A TributeHow to Find Plot Holes in Your Novel (Most Are Character Holes)Reshoring: The Factory Is the Easy PartMost of the Books I Was Forced to Read in High School Were CrapPlot Armor: Signs Your Hero Is Too Safe, and How to Fix ItShould You Sell Lifetime Rights to Your Self-Published Book for a Modest Advance?Shame Doesn’t Stop Artists From Using AI. It Stops Them From Telling You.AI Labels on TikTok and Meta Are Flagging Human WorkAuthor Richard Lowe Completes Peacekeeper, a Four-Book Science Fiction Series He Started at Age 14Sir Sam Neill: A TributeFan Art Copied by AI: Glass Houses, Copyright and the Pile-OnReal Names in a Book: Who Gets Sued, the Author, the Publisher or the Ghostwriter?When Characters Take Over the Plot, Let ThemDoes Human Writing Have a Soul?“You’re Not a Real Author”: The Pile-On Over AI-Assisted BooksDoes AI Have a Soul? Wrong QuestionHumor in Book Marketing: Getting Attention Without BeggingHow Long Should a Chapter Be? Manuscript Habits That Save You LaterThe Business Novel and the Companion Workbook: Two Formats Business Authors OverlookThe Back of the Book: Index, About the Author, Acknowledgments and Back Cover CopyI Build My Own Software Tools With Claude, and Some of Them Bit MeWhat Years of Buying From IT Vendors Taught MeI Write Books for a Living. I Barely Read Them Anymore.Three Management Habits That Waste Good PeopleThe Coach and the Webinar That Sold Me NothingThe Work I’d Cringe At Now, and Why I’m Glad I DoWho Is Your Book For? Build a Reader Avatar Before Chapter OnePreface, Prologue, Foreword or Introduction: What Goes WhereWhy I Won’t Build a Ghostwriting Business That ScalesHow I Hire a Virtual Assistant: Do It, Script It, Hand It OffThe Mail Carrier Who Thought Flipping Houses Was EasyWhat Wedding Photography Taught Me About Pricing Creative Work
The Writing King Your Ethical Ghostwriter. Your Story, Done Right.

I Spent Weeks Debugging Code That Should Have Been Deleted

TL;DR: If your team has been stuck on the same problem for more than a few days, the fastest fix is usually to delete the work and start over, and almost nobody does it. I lost weeks to a bug that turned out to be in the compiler and not in my code. I was right about the cause. Being right didn’t ship the system. My boss threw my modules away, rewrote them, and the project moved.

Deleting work you already paid for feels like losing. Keeping it is what costs you, and I paid that bill for weeks before somebody showed me.

Developers using AI tools merge far more code than they used to and their organizations ship at about the same rate. One large study found pull requests nearly doubling while review time rose almost as much and delivery metrics stayed flat. A controlled trial found experienced developers working on mature codebases were slower with AI assistance, not faster, while believing they were faster.

Something is absorbing the gains. I think a large share of it is people fixing generated code instead of throwing it out and asking again.

Why do developers keep debugging code they should rewrite?

Because rewriting feels like admitting the last three days were wasted.

They were already wasted. The only question left is whether you spend three more. That’s the sunk cost trap, and knowing the name of it doesn’t stop anyone at hour forty, when you’re close, when the next idea is going to be the one. The next idea is never the one. If it were, you wouldn’t be at hour forty.

Generating a fresh version now costs almost nothing. The economics that once justified grinding on existing code are gone, and the instinct that grew out of those economics is still here.

What happens when a bug is not in your code?

Early in my career I was the lead developer on a system for a rivet company. Rivets were the entire business. One product, made very well, and they were among the biggest in the country doing it.

We built their accounting and merchandising systems. Payables, receivables, general ledger, all of it, developed from nothing and delivered. I wrote software every night for months and I was good at it by then. That turns out to be part of the story.

Then I hit a bug I couldn’t find.

The program crashed hard and dumped a full screen of garbage. Not diagnostics. Garbage. Nothing on that screen told me anything about what had gone wrong or where.

I spent weeks on it. I read my code, rewrote sections, tested pieces in isolation, and got nowhere. Every day I was sure I was close.

Can a bug be in the compiler instead of your code?

The bug was in the compiler.

I proved it. That took a good part of those weeks. Then I opened a ticket with the vendor, a large computer manufacturer at the time, and that ticket was never resolved. As far as I know it’s still open somewhere.

Every developer learns that the bug is in your code. Thousands of people use the tool, you use your code, so the odds are overwhelming. That rule is correct almost every time.

Almost every time isn’t every time. When you land on the exception, following the correct rule costs you weeks, and there’s no way to know in advance which case you’re in.

The part under your control is how long anyone stays in the hole before getting help.

How do you know when to stop debugging and start over?

Steve Davis came in and fixed the project. He didn’t find the bug.

He took the modules I had been fighting with, threw them away, and rewrote them. That was the entire intervention. The rewritten code didn’t hit the compiler defect, the system worked, and the project moved. I was right about the cause. Steve shipped the system. Only the second one mattered to the client. I’d confused winning the argument with the vendor for delivering the work. The argument was satisfying to win, and the delivery was my job. The rule I took out of it: when something has resisted you for a while, stop asking what’s wrong with it and start asking what it would cost to delete it. Usually the answer is less than you think, because you understand the problem far better now than you did when you first wrote the thing.

Is it faster to rewrite AI-generated code than to fix it?

Often, and the reason is the same reason as forty years ago.

When you debug code you wrote, you’re working with a model of it in your head. When you debug code a machine wrote, that model doesn’t exist. You’re reverse engineering a stranger’s work to repair it, and reverse engineering is slower than writing. The research supports this. Independent analysis of code quality has found rising churn, meaning more lines written and then quickly changed again. One review reported a serious increase in security defects in AI-assisted code. That’s the shape of work that was accepted before it was understood.

The alternative takes a minute. Throw it out, change what you asked for, generate again. The cost of the second attempt is close to zero and the cost of the third hour of debugging is an hour.

Almost nobody does it, because it feels like giving up. I think that feeling is the most expensive instinct in software right now, and it’s eating the very gains teams bought the tools to get.

How long should a developer work alone before asking for help?

Less time than they do, and the reason isn’t stubbornness.

Competent people don’t ask for help because they’re competent. I’d become a good programmer, so I believed I should be able to solve a programming problem. That belief kept me in the hole.

The weaker developer asks on day two. The strong one is still there on day twelve, making excellent progress on the wrong question.

A rule fixes this and it doesn’t require anyone to admit anything. Set a limit before the work starts. Half a day, one day, whatever fits. When the limit is reached, somebody else looks at it, and that happens because it’s the rule, whether or not anyone failed.

What should a manager do when someone is stuck?

Steve Davis never chewed me out, and I still think about that. He explained what had gone wrong and how to fix it, and then we moved on. No lecture about how I should have come to him sooner. No comment on the weeks. He treated it as a technical situation with a technical answer.

I was a young developer who had just burned real time on a client project. He could have made a lesson out of it and I would have remembered the lesson. Instead I remember him. Forty years later I’m writing about it. That tells you which approach lasts.

A manager who blames gets a team that hides problems until the problems are large. A manager who explains gets told about problems while they’re still small. Every operations leader knows this and a good number of them do the other thing anyway, because blame is faster in the moment.

What did the rivet project teach about shipping?

The systems went in and they worked. Payables, receivables, general ledger, merchandising. That company ran on them. What I carried forward wasn’t a debugging technique. Nobody needs my method for isolating a compiler defect on hardware that no longer exists.

I carried forward two habits. Set a limit on how long anyone works alone on something that’s not moving. And when work has resisted you long enough, delete it and build it again with what you now know.

Both habits cost nothing, and both feel like retreat to the people who need them most. I’d rather lose three days to the delete key than three weeks to pride, and I learned that the expensive way.

Frequently Asked Questions

How much time is too much to spend on one bug?
Set the limit in advance instead of judging it in the moment, because judgment in the moment is what fails. Half a day for routine work and a full day for something complex are reasonable starting points. When the limit hits, somebody else looks at it.
Should a small team let developers rewrite working code?
Rewriting code that works is usually a poor use of time. Rewriting code that doesn’t work, after a real attempt to repair it, is often the fastest path available. The distinction is whether the thing currently does its job.
Do AI coding tools make teams faster?
At the level of a single task, usually yes. At the level of delivery, the evidence is mixed, because review, testing, and integration absorb the gains. Teams that measure only speed of writing tend to overestimate what they got.
What is code churn and why does it matter?
Churn measures how much code gets changed again shortly after it was written. Rising churn suggests work is being accepted before it’s understood, which moves the cost from writing into maintenance, where it’s harder to see and more expensive to fix.
How do you tell a developer their work should be thrown away?
Frame it as a decision about the code and not about the person, and make the call yourself so the developer doesn’t have to. Explain what will be different in the second version. The second version is almost always better, because the problem is understood by then.
Is it worth reporting a defect to a vendor?
Report it, and don’t wait on it. Vendor tickets can sit unresolved for years, and the project still has a deadline. Work around the defect first and file the report afterward.

About the Author
Richard Lowe, professional ghostwriter

Richard Lowe is a professional ghostwriter and author with 113+ books authored and 54+ ghostwritten. Before writing full time he spent 33 years in enterprise technology, including 20 years as Director of Computer Operations and Technical Services at Trader Joe's. He writes nonfiction, fiction and memoir, and works with executives and experts on books that build authority.

More about Richard Lowe →

Disclaimer

The views and opinions expressed in this blog post are solely those of Richard Lowe and are based on personal experience and research. This content is for informational purposes only and should not be construed as professional legal, financial, accounting, or business advice. Always consult with qualified professionals before making important business or legal decisions. Richard Lowe is not a lawyer, accountant, or licensed professional advisor, and this content does not establish any professional relationship.

0 comments

No comments yet. Yours can be the first.

Was this useful?

Leave a comment