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


当前回答

我经历了一个睡眠不足的编程过程,开始只写引用自《搏击俱乐部》的评论。

多年后,我仍然在浏览代码,发现了一条让我发笑的评论。大多数只是随机的想法。然而,我确实保持我的评论行比率相当好!

// This shouldn't happen. The only way this can happen is if the
// <code>JFileChooser</code> has returned a <code>File</code> that doesn't exist
// on the system. If this happens we can't recover, and there is more than likely
// a rip in the space time continuum that the user is too distracted by to notice
// anything else.

 /**
   * This method leverages collective synergy to drive "outside of the box"
   * thinking and formulate key objectives into a win-win game plan with a
   * quality-driven approach that focuses on empowering key players to drive-up
   * their core competencies and increase expectations with an all-around
   * initiative to drive down the bottom-line. I really wanted to work the word
   * "mandrolic" in there, but that word always makes me want to punch myself in
   * the face.
   */
private void updateFileCountLabel() {

其他回答

我经常看到这种情况:

// TODO make this work

//这将为我们每个用户节省0.5秒,并取悦机器精神。

在很长的程序之前:)

// need a coffee to fix this.

我经常发现这个

// fix it!

我的一个老老板总是说我们必须在内部使用我们自己的产品。“吃我们自己的狗粮……”

许多年后,我发现嵌入在一个临时同事所做的源代码中,他触及的每个函数都被标记为:

/* NOT FIT FOR HUMAN CONSUMPTION */