12 Counterproductive Coding Practices Illustrated by the Fictional Programmer “Er Gou”
The article humorously lists twelve detrimental coding habits—such as over‑splitting microservices, writing excessively long methods, nesting deep conditionals, random variable names, misleading comments, copy‑pasting code, ignoring logs, and reinventing wheels—that reduce code readability and increase maintenance difficulty.
After six or seven years of work, the author has encountered countless messy codebases, and now enumerates twelve coding "techniques" that lower readability and increase maintenance difficulty.
1. Over‑splitting microservices: one table per service
Er Gou enthusiastically adopts microservice architecture, believing each service can be developed and deployed independently, even using the latest JDK. He pushes the idea to the extreme, creating a separate service for every database table, resulting in a complex system with many RPC calls, versioning headaches, and performance issues.
2. Refactoring without production rollout
Er Gou adds a feature flag to reduce RPC calls and marks the new logic with a comment, but only enables it in the test environment. When the new code reaches production, the flag remains off, causing the next developer to modify the “new logic” that is never executed, leading to delays and frustration.
3. Writing excessively long methods (over 1000 lines)
Er Gou believes that longer methods are more coherent and showcase his skill, so he writes massive functions and never extracts smaller ones, making the code hard to understand for newcomers.
4. Deeply nested conditionals (10+ levels)
He nests multiple if/else/try‑catch blocks, claiming high code quality, but the resulting code is incomprehensible to other developers who must spend excessive time deciphering it.
5. Random, meaningless variable names
Er Gou treats naming as an art, using generic names like str1 , list2 without reflecting business meaning, which later leads to confusion and forgotten intent.
6. Writing misleading comments
He deliberately inserts incorrect comments, swapping true/false statements or moving comments to unrelated code, causing developers to waste time interpreting false guidance.
7. Changing code but never updating comments
Although Er Gou refactors heavily, he never updates the accompanying comments, resulting in a mismatch between code behavior and documentation.
8. Blindly copying code
He frequently copies and pastes code snippets without refactoring, leading to duplicated logic that is hard to maintain and prone to bugs when only some copies are updated.
9. Writing detailed technical proposals but ignoring them in implementation
Er Gou spends a lot of effort drafting elaborate design documents (e.g., a complex Redis‑based flash‑sale system) but then implements a much simpler, unrelated solution, leaving developers confused by the discrepancy.
10. Refusing to add logging
Confident in his code, Er Gou never adds logs. When a production incident occurs, the lack of logs hampers troubleshooting, forcing a rushed addition of logging after the fact.
11. Introducing heavyweight frameworks for trivial problems
He brings in rule engines (Drools, SPEL, etc.) to solve simple strategy‑selection logic, making the system unnecessarily complex and hard for newcomers to grasp.
12. Reinventing the wheel
Instead of using proven libraries (e.g., Redisson for distributed locks), Er Gou implements his own solution with SETNX , which later causes issues but gives him a sense of accomplishment.
In summary, these twelve practices degrade code readability and maintainability; developers like Er Gou exemplify what not to emulate.
Architect's Guide
Dedicated to sharing programmer-architect skills—Java backend, system, microservice, and distributed architectures—to help you become a senior architect.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.