Non-Fiction, Self-Help

Software Engineer Anger Shift eBook

Restructure this code is garbage thoughts about co

by Bruce Sena

  • English
  • 117 pages
  • 2026
  • SamEnrico

Restructure this code is garbage thoughts about colleagues' work.

Formats

Free sample

Chapter 1: The Shit Happens Theory--–- Every senior engineer has a secret shame. It is not the outage they caused at 2 AM, not the security vulnerability they introduced, not even the time they accidentally deleted the production database from a Slack command. The real shame is this: they have called someone else’s code “garbage” — and then, weeks or months or years later, discovered their own code being called the same.I remember the exact moment this happened to me. I was six months into a new job, full of the quiet arrogance that comes from having survived two startups and one acquisition. I opened a file called payment_processor_v3_final_REAL.php — the name alone should have been a warning — and felt my jaw tighten.

Six hundred lines of nested conditionals, globals sprinkled like salt, and a function called do The Thing() that ran half the billing system. I turned to my desk neighbor and whispered the words that would haunt me: “Who wrote this garbage?”He checked git blame. His face went pale. “You did. Eighteen months ago.

At your previous company. You wrote this before you left.”The file had been copied over during the acquisition.That moment split my career into two halves: the half where I believed garbage was something other people wrote, and the half where I understood the truth. This book is about the second half.The Four Types of Garbage (A Necessary Taxonomy)Before we go any further, we need a common language. Throughout this book, when I say “garbage,” I am not making a moral judgment. I am using a specific technical classification.

After studying hundreds of code review conflicts and analyzing thousands of PR comments across dozens of engineering teams, I have identified exactly four things that engineers mean when they call code garbage. Learn these four types now, because every chapter that follows will refer back to them.Type 1: Bug-Causing Garbage. This is code that objectively produces incorrect behavior. It crashes. It loses data.

It bills the customer the wrong amount. It is wrong according to the current requirements, not according to opinion. Type 1 garbage is rare — less than 10% of what engineers complain about — but it is the only type that justifies immediate, angry action.Type 2: Maintenance Garbage. This is code that is difficult to change safely. It has high coupling (changing one thing breaks five others), low cohesion (one function does six unrelated things), and few or no tests.

Type 2 garbage does not cause bugs yet, but it makes future bugs likely. It is the technical debt that slows every team down. About 30% of complaints fall here.Type 3: Aesthetic Garbage. This is code that works perfectly but violates the reader’s personal preferences. Inconsistent variable naming.

Deep nesting. Magic numbers. A switch statement where the reviewer would have used a map. This is the most common source of anger — roughly 50% of all “this code is garbage” comments — and the least justified. Type 3 garbage is the ego trap, and we will spend much of this book learning how to escape it.Type 4: Historical Garbage.

This is code that looks wrong today but was the correct decision under past constraints. A global variable because a 2019 CMS vendor required it. A slow algorithm because the dataset was tiny then. A strange API shape because a now-deprecated mobile client depended on it. Type 4 garbage is not incompetence.

It is survival. It is the scar tissue of business pressure. About 10% of complaints fall here, and they require the opposite of anger: curiosity.That file I called garbage — payment_processor_v3_final_REAL.php — was Type 4. It was written under a deadline that would have shuttered the company if missed. It was never meant to live for eighteen months.

But it worked. It processed payments. It kept the lights on. And I, in my arrogance, called it garbage because I had forgotten my own constraints.This chapter is about Type 4 garbage. It is about the hardest lesson in software engineering: most bad code is not written by bad people.

It is written by tired, pressured, under-informed humans who are doing their best with the information they have at the time.The “Shit Happens” Theory of Software Let me give you a name for this phenomenon. I call it the “Shit Happens” Theory of Software, and it goes like this:Technical debt accumulates like clutter in a shared apartment. No one wakes up intending to leave dirty dishes in the sink. No one plans to write unreadable code. But then the deadline moves.

The product manager changes the requirements for the fourth time. The senior engineer quits and takes all the context with them. The CEO announces a feature launch at a conference next week. And you make a choice: perfect code or shipping code. Every single time, shipping wins.

Because shipping pays salaries. Perfect code does not.This is not a failure of engineering discipline. It is a feature of business reality. Code is not art. It is not mathematics.

Code is a liability management system for business constraints. The best code in the world is worthless if the company runs out of money before it ships.I want you to think about the worst file in your current codebase. The one you complain about most. The one you point to when you want to feel superior. Now ask yourself: when was it written?

What was happening at the company that week? Was it before a major funding announcement? After a layoff? During the holiday season when half the team was out? Did the person who wrote it have a newborn at home?

Were they covering for a colleague who had just quit?You do not know the answers to these questions. And that is the entire problem. You are judging a battlefield decision from the comfort of the peacetime review.The Retrospective Arrogance Trap Psychologists have a name for what we do when we judge past decisions with present information. They call it hindsight bias. In software engineering, I call it retrospective arrogance, and it is the primary engine of anger in code reviews.Here is how retrospective arrogance works.

You open a file. You see a strange decision: a global variable, a nested loop, a copy-pasted block. Your brain immediately supplies a story about the person who wrote it. They were lazy. They were incompetent.

They didn’t care. This story feels true because it is simple and because it makes you feel smart.But here is what actually happened, in nine out of ten cases: the person who wrote that code was facing constraints you cannot see. They had incomplete requirements. They were told “make it work, we’ll fix it later.” They were exhausted. They were scared.

They made a reasonable trade-off given the information they had at the time.Retrospective arrogance is the belief that you would have made a different decision in their circumstances. It is almost always wrong. Because you are not in their circumstances. You are in a calm code review with full context, full test coverage, and no CEO breathing down your neck. You are comparing their wartime code to your peacetime standards.I have run…

This is the end of the free sample. Get the eBook to keep going. Buy now

About this book

Restructure this code is garbage thoughts about colleagues' work.

Details

Author
Bruce Sena
Publisher
SamEnrico
Language
English
Genre
Non-Fiction, Self-Help
Released
2026-06-10
Pages (approx.)
117
Available as
eBook, Audiobook

Read better in the ZLOADR app

Your eBooks on your phone or tablet. Sign in with your SamEnrico account and start reading.

More by Bruce Sena

See all

You may also like

See all