-
Notifications
You must be signed in to change notification settings - Fork 1.2k
1-js/03-code-quality/04-ninja-code #38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
resolve #20
@leviding 校对认领 |
@Starriers ok |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
- **The ideal name for a variable is `data`.** Use it everywhere you can. Indeed, every variable holds *data*, right? | ||
- **一个变量的理想名称是 `data`。** 在任何能用的地方都使用它。的确,每个变量都持有 *data*,对吧? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里 data 加粗
|
||
...But what to do if `data` is already taken? Try `value`, it's also universal. After all, a variable eventually gets a *value*. | ||
...但是 `data` 已经用过了怎么办?可以尝试一下 `value`,它也很普遍呢。一个变量总会有一个 *value*,对吧? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Value 加粗
|
||
- **Name a variable by its type: `str`, `num`...** | ||
- **根据变量的类型命名:`str`, `num`...** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不要英文的符号,用中文的顿号
|
||
- **...But what if there are no more such names?** Just add a number: `data1, item2, elem5`... | ||
- **...但是如果找不到更多这样的名字呢?** 可以加一个数字:`item1, item2, elem5, data1`... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同类型用顿号
|
||
**One of the ways -- use similar variable names, like `date` and `data`.** | ||
**方式之一 -- 使用相似的变量名,像 `date` 和 `data`.** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
破折号用中文的
|
||
That would make it really hard to identify what's exactly in the variable *now*. And also where it comes from. A person with weak intuition would have to analyze the code line-by-line and track the changes through every code branch. | ||
这样就无法确定这个变量现在是什么了。也不知道它是从哪里来的。一个弱直觉的人必须逐行分析代码,并通过每个代码分支跟踪变化 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
现在加粗
|
||
Like this: | ||
像这样: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
点 用中文的
|
||
## Soar high. Be abstract. | ||
## Soar high. 抽象化。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
点去掉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Starriers 你觉得这个 “Soar high” 翻译成什么合适一点呢?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不好意思哈 今天一天都在图书馆 刚看到
我以为你是故意不翻译的
要是我翻译的话,我会翻译成 增强语义的抽象化
soar 有提高的意思,high 用于加强语气。按照上下文,所以我会那么翻译
|
||
That would make it really hard to identify what's exactly in the variable *now*. And also where it comes from. A person with weak intuition would have to analyze the code line-by-line and track the changes through every code branch. | ||
这样就无法确定这个变量现在是什么了。也不知道它是从哪里来的。一个弱直觉的人必须逐行分析代码,并通过每个代码分支跟踪变化 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
少了句号
The Dao hides in wordlessness. Only the Dao is well begun and well | ||
completed. | ||
```quote author="老子(道德经)" | ||
道隐无名。夫唯道善贷且成。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
少了一行翻译 导致文章结构问题
resolve #20