CTO:這代碼注釋讓我笑T了...
點(diǎn)擊上方[全棧開(kāi)發(fā)者社區(qū)]→右上角[...]→[設(shè)為星標(biāo)?]
點(diǎn)擊領(lǐng)取全棧資料:全棧資料
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
?*親愛(ài)的維護(hù)者
如果嘗試對(duì)這段程序進(jìn)行'優(yōu)化'
并且您已經(jīng)意識(shí)到這是一個(gè)多么可怕的錯(cuò)誤,
請(qǐng)?jiān)黾右韵掠?jì)數(shù)器的個(gè)數(shù)用來(lái)對(duì)后來(lái)人進(jìn)行警告
這里總共浪費(fèi)的時(shí)間= 73?
1.
Exception?up?=?new?Exception("Something?is?really?wrong.");
throw?up;??//ha?ha
例外=新的異常("確實(shí)有問(wèn)題。")
放棄; //哈哈
//?When?I?wrote?this,?only?God?and?I?understood?what?I?was?doing
//?Now,?God?only?knows
當(dāng)我寫(xiě)下這個(gè)的時(shí)候,只有上帝和我明白我在做什么?
現(xiàn)在,只有上帝知道
3.
//?sometimes?I?believe?compiler?ignores?all?my?comments
有時(shí),我會(huì)相信編譯器會(huì)忽略我所有的注釋
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.
謹(jǐn)以此代碼,獻(xiàn)給我的妻子達(dá)琳,感謝她一直支持著我,以及我的三個(gè)孩子和一條狗。
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)
誰(shuí)在乎?
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.
*/
你可能相信你能看懂以下代碼,
但是其實(shí)絕對(duì)不可能,相信我。
一旦你調(diào)試了,你絕對(duì)會(huì)后悔裝聰明去嘗試優(yōu)化這段代碼。
最好的方式是關(guān)閉文件,
去玩點(diǎn)兒你喜歡的東西吧!
12.
try?{
}?finally?{?//?should?never?happen
}
絕對(duì)不會(huì)運(yùn)行到這里
13.
const?int?TEN=10;?//?As?if?the?value?of?10?will?fluctuate...
好像 10 的值會(huì)波動(dòng)...
14.
//?This?code?sucks,?you?know?it?and?I?know?it.
//?Move?on?and?call?me?an?idiot?later.
這段代碼的確很爛,我知道你也知道,
先不要罵我,請(qǐng)先接著往下看
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.
我不負(fù)責(zé)這個(gè)代碼
他們強(qiáng)迫我寫(xiě),違背了我的意愿。
17.
/*?Please?work?*/
請(qǐng)工作
18.
//?no?comments?for?you
//?it?was?hard?to?write
//?so?it?should?be?hard?to?read
沒(méi)有注釋,
很難寫(xiě),
所以它應(yīng)該很難閱讀
19.
options.BatchSize?=?300;?//Madness??THIS?IS?SPARTA!
瘋了吧?這是斯巴達(dá)!
20.
//?If?this?code?works,?it?was?written?by?Paul?DiLascia.
//?If?not,?I?don't?know?who?wrote?it
如果這個(gè)代碼能夠正常工作,那么是Paul DiLascia寫(xiě)的?
否則,我也不知道是誰(shuí)寫(xiě)的
21.
//?Peter?wrote?this,?nobody?knows?what?it?does,?don't?change?it!
這是彼得寫(xiě)的,沒(méi)人知道它是做什么的,別改動(dòng)!
22.
/**?Logger?*/
private?Logger?logger?=?Logger.getLogger();
不管怎么費(fèi)盡心力,人會(huì)受傷的時(shí)候就會(huì)受傷。by 村上春樹(shù)
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.
真正的程序員不注釋他們的代碼。
如果很難寫(xiě)
應(yīng)該是難以理解
25.
//?This?is?black?magic
//?from
//?*Some?stackoverlow?link
//?Don’t?play?with?magic,?it?can?BITE.
這是來(lái)自stackoverlow的黑魔法
別玩魔法,它會(huì)咬人的
26.
//?For?the?sins?I?am?about?to?commit,?may?James?Gosling?forgive?me
對(duì)于我即將犯下的罪行,希望詹姆斯·高斯林(James Gosling)能原諒我
27.
//?Comment?this?later
稍后對(duì)此注釋
28.
//?Remove?this?if?you?wanna?be?fired
如果你想被炒魷魚(yú),就刪除它
29.
}catch(Exception?ex){
//?Houston,?we?have?a?problem
}
Houston,我們有一個(gè)問(wèn)題
30.
//?I?can’t?divide?with?zero,?so?I?have?to?divide?with?something?very?similar?
result?=?number?/?0.00000000000001.
我不能除以0,所以我要除以一個(gè)非常相似的數(shù)
31.
int?getRandomNumber()
{
Return?4;?//?chosen?by?fair?dice?roll.
//?guaranteed?to?be?random.
}
通過(guò)公平擲骰子選擇
保證是隨機(jī)的
32.
#TODO:?Figure?out?what?I’m?doing?here?and?comment?accordingly.
弄清楚這里做什么并相應(yīng)地添加注釋
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...
如果這段代碼停止工作時(shí)還在使用,
殺了我吧,哦~你不能這么做
我死了......
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.
如果你看到了這里,這意味著你已經(jīng)被任命為我之前的項(xiàng)目的負(fù)責(zé)人。
對(duì)不起,真抱歉。祝你好運(yùn)。
35.
//?I?wrote?this?while?drunk,?I?don’t?know?what?it?does,?
//?but?if?you?remove?it?the?program?breaks.
我是在喝醉的時(shí)候?qū)懙模圆恢浪歉墒裁从玫?/p>
但如果你刪除它,程序就會(huì)中斷
36.
//?This?code?worked?before,?but?my?cat?decided?to?take?a?
//?trip?across?my?keyboard...
這段代碼以前是有效的,但是我的貓決定在我的鍵盤(pán)上跑一趟
37.
long?long?ago;?/*?in?a?galaxy?far?far?away?*/
在很遠(yuǎn)很遠(yuǎn)的銀河系外 (這段代碼能運(yùn)行,絕對(duì)是個(gè)奇跡)
38.
long?john;?//?silver
金銀島
39.
#define?TRUE?FALSE?//?Happy?debugging?suckers
快樂(lè)的去調(diào)試你的代碼吧,哈哈
40.
//?Dear?future?me.?Please?forgive?me.
//?I?can't?even?begin?to?express?how?sorry?I?am.
未來(lái)親愛(ài)的我,請(qǐng)?jiān)徫?
我說(shuō)不出來(lái)我有多抱歉
41.
//?private?instance?variable?for?storing?age
public?static?int?age;
用于存儲(chǔ)年齡的私有實(shí)例變量
42.
//?I?am?not?sure?why?this?works?but?it?fixes?the?problem.
雖然我不知道為什么這樣管用,但它卻是修復(fù)了問(wèn)題
43.
last?=?first;?/*?Biblical?reference?*/
最后即是開(kāi)始,圣經(jīng)引用
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!!!
}
不用多說(shuō),基本上你完蛋了
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.
如果你再刪除一次
看在上帝的份上,我要關(guān)閉你
這段代碼不是什么“奇怪的東西”
那就是身份驗(yàn)證
46.
long?time;?/*?know?C?*/
過(guò)來(lái)很久時(shí)間才知道
47.
//?Abandon?all?hope?ye?who?enter?beyond?this?point
入此門(mén)者了斷希望
48.
/*?Ah?ah?ah!?You'll?never?understand?why?this?one?works.?*/
啊啊啊!你永遠(yuǎn)都不會(huì)明白為什么這個(gè)方法有效
49.
catch?(Ex?as?Exception)?{
//?oh?crap,?we?should?do?something.
}
糟糕,我們應(yīng)該做點(diǎn)什么
50.
//?TODO?make?this?work
用TODO做這件事
51.
//?If?you're?reading?this,?then?my?program?is?probably?a?success
如果你現(xiàn)在在認(rèn)真詳細(xì)的閱讀這段代碼,那么寫(xiě)的這段代碼應(yīng)該是沒(méi)有問(wèn)題的
52.
//?set?break?point?here?-?you'll?never?reach?it
在這里設(shè)置斷點(diǎn)-你永遠(yuǎn)作不到十全十美
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.
*/
作者放棄此源代碼的版權(quán)
這是一份祝福,而不是法律通知
愿你行善不作惡。
愿你寬恕自己,寬恕他人
愿你自由分享,永遠(yuǎn)不要超過(guò)付出
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.
這是垃圾代碼,但現(xiàn)在是凌晨3點(diǎn),我需要讓他能夠正常運(yùn)行
覺(jué)得本文對(duì)你有幫助?請(qǐng)分享給更多人
關(guān)注「全棧開(kāi)發(fā)者社區(qū)」加星標(biāo),提升全棧技能
本公眾號(hào)會(huì)不定期給大家發(fā)福利,包括送書(shū)、學(xué)習(xí)資源等,敬請(qǐng)期待吧!
如果感覺(jué)推送內(nèi)容不錯(cuò),不妨右下角點(diǎn)個(gè)在看轉(zhuǎn)發(fā)朋友圈或收藏,感謝支持。
好文章,留言、點(diǎn)贊、在看和分享一條龍吧??
