Shikhil Saxena

Oct 08, 2025 • 1 min read

How to Write Garbage Code

🧠 Core Idea: Reduce Cognitive Load

Linus Torvalds harshly criticized a Meta engineer’s pull request, calling out a helper function make_u32_from_two_u16() as “useless garbage.” His main argument? It obscures intent and increases cognitive load.

🔍 Key Takeaways:

  • Explicit > Abstract: Writing (a << 16) + b is clearer than using a helper function that hides logic.

  • PRY > DRY: “Please Repeat Yourself” can be better than “Don’t Repeat Yourself” when duplication reduces mental overhead.

  • Micro-Context Switches Matter: Jumping across files/functions adds cognitive cost for humans and LLMs alike.

  • Chunking Limits: Human brains can only hold 4–7 “chunks” at a time—each abstraction eats into that.

  • Locality of Reference: Keeping related code together improves readability and iteration speed.

  • Refactorability > Premature Optimization: With modern IDEs and LLMs, duplication is cheap and easy to clean up later.

⚠️ Tone Matters

While Linus’s technical point is valid, the article cautions against emulating his aggressive tone. Constructive feedback fosters better collaboration.

Join Shikhil on Peerlist!

Join amazing folks like Shikhil and thousands of other builders on Peerlist.

peerlist.io/

It’s available... this username is available! 😃

Claim your username before it's too late!

This username is already taken, you’re a little late.😐

1

6

0