Conversation
resolve #19
Contributor
|
校对认领 |
Starriers
reviewed
Apr 22, 2018
| # 注释 | ||
|
|
||
| As we know from the chapter <info:structure>, comments can be single-line: starting with `//` and multiline: `/* ... */`. | ||
| 正如我们在 <info:structure> 这一章所了解到的那样,注释可以是以 `//` 开始的单行注释,或是 `/* ... */` 结构的多行注释。 |
| 从第一眼看,注释代表的东西可能是显而易见的,但编程中的新手通常会弄错。 | ||
|
|
||
| ## Bad comments | ||
| ## 坏注释 |
| - 只有在没有这些就不可能使代码变得如此简单和自我描述的情况下才可以使用它们。 | ||
|
|
||
| Comments are also used for auto-documenting tools like JSDoc3: they read them and generate HTML-docs (or docs in another format). | ||
| 注释也被用于一些自动文档工具:他们读取注释然后构建出 HTML 文档(或者其他格式)。 |
Contributor
There was a problem hiding this comment.
在工具后加上 (比如 JSDoc3)
或者其他格式 =》或者其他格式的文档。
发现译者翻译喜欢省略内容,改原文格式。意译的时候一些重要的信息还是保留比较好,比较它们存在都是有原因的。
| - Important solutions, especially when not immediately obvious. | ||
| - 整体架构,高层次的观点。 | ||
| - 函数的用法。 | ||
| - 重要的解决方案,特别是当不是很明显时。 |
| ``` | ||
|
|
||
| Now we can understand the code easily. The function itself becomes the comment. Such code is called *self-descriptive*. | ||
| 现在我们可以很容易的理解代码了。函数自己变成了注释。这种代码被称之为“自我描述型”代码。 |
Signed-off-by: sqrtthree <imsqrtthree@gmail.com>
Author
|
感谢建议,已调整。 |
leviding
reviewed
Apr 23, 2018
| Why is the task solved this way? | ||
| : What's written is important. But what's *not* written may be even more important to understand what's going on. Why is the task solved exactly this way? The code gives no answer. | ||
| 为什么任务以这种方式解决? | ||
| : 写了什么代码很重要。但是什么代码**不**写对于理解发生了什么或许更重要。为什么任务恰好用这种方式解决了?代码并没有给出答案。 |
Author
leviding
approved these changes
Apr 23, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

resolve #19