Common Rookie Mistakes Every Programmer Should Avoid
This article reviews a series of typical programming blunders—from incorrect local file includes and obscure character usage to excessive if‑else chains, meaningless variable names, hard‑coded outputs, missing returns, and thread‑sleep misuse—offering concrete examples and community comments to help developers learn from these errors.
As programmers, we all start as beginners and inevitably make silly mistakes that become valuable learning milestones.
Include Local File
include "d:\xxxxxxxxxxx.h"Running code locally works fine, but after sharing it, the include path often breaks.
Guarantees personal indispensability.
No one else can run it.
Everyone has a D: drive, right?
Using Obscure Characters
The Chinese character "丨" looks like the vertical bar "|" in English.
丨 (Chinese character gǔn) I (uppercase i) l (lowercase L) | (full‑width separator) | (half‑width separator) Ⅰ (Roman numeral one)
Using it as a string delimiter once caused a colleague to spend an entire afternoon debugging.
if‑else Explosion
Chaining dozens of if‑else statements leads to poor performance and tedious maintenance.
Meaningless Variable Names
int x,y,z,w,v,u,l,m,n,o,p,q,r,s,a1,b1;Months later, it's impossible to recall the purpose of these variables.
Hard‑Coded Output
Instead of calculating output, some developers directly print fixed strings, which can also affect security when used for passwords.
Thread Waiting
QThread::sleep(1000); // sleeps for 1000 secondsMisunderstanding the unit (seconds vs. milliseconds) can cause excessive delays.
Later, someone suggested using 999 seconds.
Variable Name and Meaning Mismatch
Comments suggest these are used to test color blindness or stem from misunderstanding naming conventions.
Missing Return Statement
Forgetting to add a return caused a function to return null, leading to hours of debugging.
These examples illustrate that embracing our mistakes helps us grow into better programmers.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Java High-Performance Architecture
Sharing Java development articles and resources, including SSM architecture and the Spring ecosystem (Spring Boot, Spring Cloud, MyBatis, Dubbo, Docker), Zookeeper, Redis, architecture design, microservices, message queues, Git, etc.
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.
