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.
Reading font
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.
For questions about attribution, corrections or content rights, please contactand we will review it promptly.