程序員的幽默(ID:humor1024)整理
老衲不請自來,
給大家獻上一波神註釋
供施主們娛樂娛樂
0.
/*
* Dear Maintainer
*
* Once you are done trying to ‘optimize’ this routine,
* and you have realized what a terrible mistake that was,
* please increment the following counter as a warning
* to the next guy.
*
* total_hours_wasted_here = 73
*
親愛的維護者
如果嘗試對這段程序進行'優化'
並且您已經意識到這是一個多麼可怕的錯誤,
請增加以下計數器的個數用來對後來人進行警告
這裏總共浪費的時間= 73
1.
Exception up = new Exception("Something is really wrong.");
throw up; //ha ha
例外=新的異常("確實有問題。")
放棄; //哈哈
2.
// When I wrote this, only God and I understood what I was doing
// Now, God only knows
當我寫下這個的時候,只有上帝和我明白我在做什麼
現在,只有上帝知道
3.
// sometimes I believe compiler ignores all my comments
有時,我會相信編譯器會忽略我所有的註釋
4.
// I dedicate all this code, all my work, to my wife, Darlene,
// who will have to support me and our three children and
// the dog once it gets released into the public.
謹以此代碼,獻給我的妻子達琳,感謝她一直支持着我,以及我的三個孩子和一條狗。
5.
// drunk, fix later
喝多了,改天再修
6.
// Magic. Do not touch.
魔法!不要碰。
7.
// I'm sorry.
抱歉。
8.
return 1; # returns 1
返回 1;# 返回 1
9.
Catch (Exception e) {
//who cares?
}
捕獲(異常e)
誰在乎?
10.
/**
* Always returns true.
*/
public boolean isAvailable() {
return false;
}
代碼返回 false ,註釋則始終返回 true
11.
/*
* You may think you know what the following code does.
* But you dont. Trust me.
* Fiddle with it, and youll spend many a sleepless
* night cursing the moment you thought youd be clever
* enough to "optimize" the code below.
* Now close this file and go play with something else.
*/
你可能相信你能看懂以下代碼,
但是其實絕對不可能,相信我。
一旦你調試了,你絕對會後悔裝聰明去嘗試優化這段代碼。
最好的方式是關閉文件,
去玩點兒你喜歡的東西吧!
12.
try {
} finally { // should never happen
}
絕對不會運行到這裏
13.
const int TEN=10; // As if the value of 10 will fluctuate...
好像 10 的值會波動...
14.
// This code sucks, you know it and I know it.
// Move on and call me an idiot later.
這段代碼的確很爛,我知道你也知道,
先不要罵我,請先接着往下看
15.
// If this comment is removed the program will blow up
如果刪了此處註釋,程序就炸了
16.
// I am not responsible of this code.
// They made me write it, against my will.
我不負責這個代碼
他們強迫我寫,違背了我的意願。
17.
/* Please work */
請工作
18.
// no comments for you
// it was hard to write
// so it should be hard to read
沒有註釋,
很難寫,
所以它應該很難閱讀
19.
options.BatchSize = 300; //Madness? THIS IS SPARTA!
瘋了吧?這是斯巴達!
20.
// If this code works, it was written by Paul DiLascia.
// If not, I don't know who wrote it
如果這個代碼能夠正常工作,那麼是Paul DiLascia寫的
否則,我也不知道是誰寫的
21.
// Peter wrote this, nobody knows what it does, don't change it!
這是彼得寫的,沒人知道它是做什麼的,別改動!
22.
/** Logger */
private Logger logger = Logger.getLogger();
不管怎麼費盡心力,人會受傷的時候就會受傷。by 村上春樹
23.
// I have to find a better job
我必須找到更好的工作
24.
// Real programmers don’t comment their code.
// If it was hard to write,
// it should be hard to understand.
真正的程序員不註釋他們的代碼。
如果很難寫
應該是難以理解
25.
// This is black magic
// from
// *Some stackoverlow link
// Don’t play with magic, it can BITE.
這是來自stackoverlow的黑魔法
別玩魔法,它會咬人的
26.
// For the sins I am about to commit, may James Gosling forgive me
對於我即將犯下的罪行,希望詹姆斯·高斯林(James Gosling)能原諒我
27.
// Comment this later
稍後對此註釋
28.
// Remove this if you wanna be fired
如果你想被炒魷魚,就刪除它
29.
}catch(Exception ex){
// Houston, we have a problem
}
Houston,我們有一個問題
30.
// I can’t divide with zero, so I have to divide with something very similar
result = number / 0.00000000000001.
我不能除以0,所以我要除以一個非常相似的數
31.
int getRandomNumber()
{
Return 4; // chosen by fair dice roll.
// guaranteed to be random.
}
通過公平擲骰子選擇
保證是隨機的
32.
#TODO: Figure out what I’m doing here and comment accordingly.
弄清楚這裏做什麼並相應地添加註釋
33.
// If this code is still being used when it stops working, then
// you have my permission to shoot me. Oh, you won't be able
// to - I'll be dead...
如果這段代碼停止工作時還在使用,
殺了我吧,哦~你不能這麼做
我死了......
34.
// If you are reading this, that means you have been put in charge of my previous project.
// I am sorry, so sorry for you. Godspeed.
如果你看到了這裏,這意味着你已經被任命爲我之前的項目的負責人。
對不起,真抱歉。祝你好運。
35.
// I wrote this while drunk, I don’t know what it does,
// but if you remove it the program breaks.
我是在喝醉的時候寫的,所以不知道它是幹什麼用的
但如果你刪除它,程序就會中斷
36.
// This code worked before, but my cat decided to take a
// trip across my keyboard...
這段代碼以前是有效的,但是我的貓決定在我的鍵盤上跑一趟
37.
long long ago; /* in a galaxy far far away */
在很遠很遠的銀河系外 (這段代碼能運行,絕對是個奇蹟)
38.
long john; // silver
金銀島
39.
#define TRUE FALSE // Happy debugging suckers
快樂的去調試你的代碼吧,哈哈
40.
// Dear future me. Please forgive me.
// I can't even begin to express how sorry I am.
未來親愛的我,請原諒我
我說不出來我有多抱歉
41.
// private instance variable for storing age
public static int age;
用於存儲年齡的私有實例變量
42.
// I am not sure why this works but it fixes the problem.
雖然我不知道爲什麼這樣管用,但它卻是修復了問題
43.
last = first; /* Biblical reference */
最後即是開始,聖經引用
44.
try {
} catch (SQLException ex) {
// Basically, without saying too much, you're screwed. Royally and totally.
} catch(Exception ex)
{
//If you thought you were screwed before, boy have I news for you!!!
}
不用多說,基本上你完蛋了
45.
// John! If you'll svn remove this once more,
// I'll shut you, for God's sake!
// That piece of code is not "something strange"!
// That is THE AUTH VALIDATION.
如果你再刪除一次
看在上帝的份上,我要關閉你
這段代碼不是什麼“奇怪的東西”
那就是身份驗證
46.
long time; /* know C */
過來很久時間才知道
47.
// Abandon all hope ye who enter beyond this point
入此門者了斷希望
48.
/* Ah ah ah! You'll never understand why this one works. */
啊啊啊!你永遠都不會明白爲什麼這個方法有效
49.
catch (Ex as Exception) {
// oh crap, we should do something.
}
糟糕,我們應該做點什麼
50.
// TODO make this work
用TODO做這件事
51.
// If you're reading this, then my program is probably a success
如果你現在在認真詳細的閱讀這段代碼,那麼寫的這段代碼應該是沒有問題的
52.
// set break point here - you'll never reach it
在這裏設置斷點-你永遠作不到十全十美
53.
/*
** The author disclaims copyright to this source code.
** In place of a legal notice, here is a blessing:
**
** May you do good and not evil.
** May you find forgiveness for yourself and forgive others.
** May you share freely, never taking more than you give.
*/
作者放棄此源代碼的版權
這是一份祝福,而不是法律通知
願你行善不作惡。
願你寬恕自己,寬恕他人
願你自由分享,永遠不要超過付出
54.
// I'm not sure what I did
我不確定我做了什麼
55.
// This is crap code but it's 3 a.m. and I need to get this working.
這是垃圾代碼,但現在是凌晨3點,我需要讓他能夠正常運行
往期推薦
關注我回復「加羣」,加入Spring技術交流羣
本文分享自微信公衆號 - 程序猿DD(didispace)。
如有侵權,請聯繫 [email protected] 刪除。
本文參與“OSC源創計劃”,歡迎正在閱讀的你也加入,一起分享。