你遇到过的源代码中最好的注释是什么?


当前回答

来自Java 1.2的SwingUtilities:

doRun.run();  // ... "a doo run run".

其他回答

这不是严格意义上的评论,但是…

那是20世纪90年代中期,我正在进行一次大的迁移:小软件供应商,大客户,压力很大。我们有很多转移门柱的东西;这个项目很难控制。我是关键的开发人员,但对系统还不熟悉,而另一个开发人员是供应商的所有者/创始人。

在几个月没有按时完成任务,也没有让客户满意之后,公司的所有者/创始人找来了另一名远程工作的开发人员。(我可以大胆地说,新开发人员的技能和经验都不如我。)

好吧,这个新人对我已经做过的代码做了一些更改,然后一两个月后我又回到了代码的同一区域,其中有一些我以前没有见过的变量。他的名字叫StupidMark。

伙计,这是不对的。我的意思是,有团队合作方面的考虑,但是:在这个环境中,变量名可能会出现在运行时错误消息中。我只是说说而已。

在我看来,那个新人的代码并没有让我们更接近可交付的产品,这让侮辱变得更伤人了。

试着在谷歌代码搜索中输入你最喜欢的脏话,它会消磨掉许多无聊的时间。以下是我最喜欢的例子:

/* These magic numbers are fucking stupid. */

/* Dear free software world, do you NOW see we are fucking
   things up?! This is insane! */

/* We will NOT put a fucking timestamp in the header here. Every
   time you put it back, I will come in and take it out again. */

# However, this only works if there are MULTIPLE checkboxes!
# The fucking JS DOM *changes* based on one or multiple boxes!?!?!
# Damn damn damn I hate the JavaScript DOM so damn much!!!!!!

/* TODO: this is obviously not right ... this whole fucking module
   sucks anyway */

/* FIXME: please god, when will the hurting stop? Thus function is so
   fucking broken it's not even funny. */

我个人最喜欢的

 # code below replaces code above - any problems?
 # yeah, it doesn't fucking work.
// drunk, fix later

真希望我是在开玩笑。根据编写代码的开发人员的了解,我认为他是认真的。

#pragma region Crap that is kept for temporary reasons

    //  Huge chunk of commented code

#pragma endregion
// Replaces with spaces the braces in cases where braces in places cause stasis 
   $str = str_replace(array("\{","\}")," ",$str);