源代码中遇到过的最好的评论是什么?

源代码中遇到过的最好的评论是什么?


我对此特别有罪,在我的大部分项目中都嵌入了非建设性的评论,代码诗和小小的笑话(尽管我通常有足够的理解在发布代码之前删除任何直接冒犯的东西)。 这是我特别喜欢的一个,远远落在一个设计不好的“神物”上:

/**
* For the brave souls who get this far: You are the chosen ones,
* the valiant knights of programming who toil away, without rest,
* fixing our most awful code. To you, true saviors, kings of men,
* I say this: never gonna give you up, never gonna let you down,
* never gonna run around and desert you. Never gonna make you cry,
* never gonna say goodbye. Never gonna tell a lie and hurt you.
*/

对不起!!!! 我只是忍不住自己.....!

还有一个,我承认我并没有真的放到野外,即使我在我的一个不那么直观的类中很想做到这一点:

// 
// Dear maintainer:
// 
// Once you are done trying to 'optimize' this routine,
// and have realized what a terrible mistake that was,
// please increment the following counter as a warning
// to the next guy:
// 
// total_hours_wasted_here = 42
// 

Exception up = new Exception("Something is really wrong.");
throw up;  //ha ha

//When I wrote this, only God and I understood what I was doing
//Now, God only knows
链接地址: http://www.djcxy.com/p/20583.html

上一篇: What is the best comment in source code you have ever encountered?

下一篇: How to escape the double quotes in java not as \" but \\u0022