Skip to content

Conversation

@XiaoLuo01
Copy link
Contributor

@XiaoLuo01 XiaoLuo01 commented Jul 22, 2018

翻译章节

《算法和数据结构——面向对象编程》

变更文件

  • object-oriented-programming.json

  • object-oriented-programming.md

翻译进度

  • 40%

  • 0%

@S1ngS1ng S1ngS1ng added the ready for review Use when a translation (?) PR is ready for review label Jul 22, 2018
@XiaoLuo01 XiaoLuo01 changed the title Translate of object-oriented-programming, 20% completed Translate of object-oriented-programming Jul 23, 2018
@huluoyang huluoyang changed the title Translate of object-oriented-programming Translate object-oriented-programming Jul 24, 2018

# Sublime
*.sublime-workspace

Copy link
Contributor

@S1ngS1ng S1ngS1ng Jul 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个既然不是你的 changes,请把这个改动删掉,否则后续会很难管理。
记得以后使用 git pull --rebase,就不会有这个问题了。
如果不确定如何操作,有空了微信我

@S1ngS1ng S1ngS1ng self-assigned this Jul 25, 2018
@S1ngS1ng S1ngS1ng removed their assignment Jul 26, 2018
Copy link
Contributor

@S1ngS1ng S1ngS1ng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@XiaoLuo01 @huluoyang 考虑下:
我觉得,前面对实际生活的描述中,object 应该翻译成“物体”。毕竟object本身就有这个意思。
或者可以加一句:
在英文中,object 既有“对象”又有“物体”的意思
你们觉得?

@XiaoLuo01 主要是通顺性的问题。改的时候多读几遍吧

"What are some qualities of these <code>objects</code>? A car has wheels. Shops sell items. Birds have wings.",
"These qualities, or <code>properties</code>, define what makes up an <code>object</code>. Note that similar <code>objects</code> share the same <code>properties</code>, but may have different values for those <code>properties</code>. For example, all cars have wheels, but not all cars have the same number of wheels.",
"<code>Objects</code> in JavaScript are used to model real-world objects, giving them <code>properties</code> and behavior just like their real-world counterparts. Here's an example using these concepts to create a <code>duck</code> <code>object</code>:",
"想想我们在生活中每天都可见到的事物:比如汽车、商店以及小鸟等。这些都是 <code>对象</code>:所以对象就是这些人们可以观察和与之互动的实体事物。",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这些都是 <code>对象</code>
这里“是”之后不需要空格,因为“对象”也是全角字符。

下同


这里和下文的“对象”(包括评论中的),如果指的是实际生活中的东西,我觉得翻译成“物体”更合适。见 review comments

这里的 line comments,我就先用“对象”代替了

"想想我们在生活中每天都可见到的事物:比如汽车、商店以及小鸟等。这些都是 <code>对象</code>:所以对象就是这些人们可以观察和与之互动的实体事物。",
"那么这些 <code>对象</code> 都有哪些特征呢?比如汽车的特征是有轮子,商店是用来出售商品的,而小鸟的特征是有翅膀。",
"这些特征,或者说是 <code>属性</code> 定义了一个 <code>对象</code> 由什么构成的。需要注意的是:那些相似的 <code>对象</code> 可以拥有相同的 <code>属性</code>,但是这些 <code>属性</code> 可能会有不同的值。举个例子:所有的汽车都有轮子,但并不是所有汽车的轮子个数都是一样的。",
"Javascript 中的 <code>对象</code> 被用来模拟现实世界中的对象,并赋予他们 <code>属性</code> 和行为,就像它们在现实世界中的对应物一样。下面是使用这些概念来创建一个 <code>duck</code> <code>对象</code> 的示例:",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Javascript => JavaScript
注意大小写

image


被用来模拟现实世界中的对象 这句,建议改成主动句,读起来通顺些。
其实 model 在这里有点儿“建模”的意思。感觉说“是对现实世界中对象的抽象”,会不会更好更难理解= =

建议:JavaScript 中的 <code>对象</code> 可以用来描述现实世界中的对象

特别是这句,我觉得翻译成“物体”更好。毕竟,现实生活中说“对象”,比较奇怪(第一反应肯定是别的意思 🌝

"Javascript 中的 <code>对象</code> 被用来模拟现实世界中的对象,并赋予他们 <code>属性</code> 和行为,就像它们在现实世界中的对应物一样。下面是使用这些概念来创建一个 <code>duck</code> <code>对象</code> 的示例:",
"<blockquote>let duck = {<br>&nbsp;&nbsp;name: \"Aflac\",<br>&nbsp;&nbsp;numLegs: 2<br>};</blockquote>",
"This <code>duck</code> <code>object</code> has two property/value pairs: a <code>name</code> of \"Aflac\" and a <code>numLegs</code> of 2.",
"这个 <code>duck</code> <code>对象</code> 有两组键值对:一个是属性 <code>name</code> 的值是 \"Aflac\" 和 一个是属性 <code>numLegs</code> 的值是2。",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

但这里翻译成“对象”,我觉得没问题


一个是属性 <code>name</code> 的值是 \"Aflac\" 和 一个是属性 <code>numLegs</code> 的值是2。 =>

一个是属性 <code>name</code>,它的值为 \"Aflac\";另一个是属性 <code>numLegs</code>,它的值是 2。

2 之前要加空格

"这个 <code>duck</code> <code>对象</code> 有两组键值对:一个是属性 <code>name</code> 的值是 \"Aflac\" 和 一个是属性 <code>numLegs</code> 的值是2。",
"<hr>",
"Create a <code>dog</code> <code>object</code> with <code>name</code> and <code>numLegs</code> properties, and set them to a string and a number, respectively."
"创建一个 <code>dog</code> <code>对象</code>,并给这个对象添加两个属性:<code>name</code> <code>numLegs</code>,同时分别给这两个属性设置一个字符串和数字。"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

分别给这两个属性设置一个字符串和数字。 =>
把这两个属性的值分别设为字符串和数字。

{
"text": "<code>dog</code> should be an <code>object</code>.",
"testString": "assert(typeof(dog) === 'object', '<code>dog</code> should be an <code>object</code>.');"
"text": "<code>dog</code> 应该就是一个 <code>object</code>",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

应该就是 => 应该是

下一行也要改

"<strong>注意:</strong><br>由于 <code>constructor</code> 属性可以被重写(在下面两节挑战中将会遇到) 所以通常使用 <code>instanceof</code> 方法来检查对象的类型要更好。",
"<hr>",
"Write a <code>joinDogFraternity</code> function that takes a <code>candidate</code> parameter and, using the <code>constructor</code> property, return <code>true</code> if the candidate is a <code>Dog</code>, otherwise return <code>false</code>."
"写一个 <code>joinDogFraternity</code> 函数,传入一个 <code>candidate</code> 参数并使用 <code>constructor</code> 属性来判断传入的 candidate 是不是 <code>Dog</code> 创建的对象实例,如果是返回 <code>true</code> 否则返回 <code>false</code>"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果是返回 <code>true</code> 否则返回 <code>false</code>。 =>
如果是,就返回 <code>true</code>,否则返回 <code>false</code>。

{
"text": "<code>joinDogFraternity</code> should use the <code>constructor</code> property.",
"testString": "assert(/\\.constructor/.test(code) && !/instanceof/.test(code), '<code>joinDogFraternity</code> should use the <code>constructor</code> property.');"
"text": "<code>joinDogFraternity</code> 应该要使用 <code>constructor</code> 属性。",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<code>joinDogFraternity</code> 应该要使用 =>
<code>joinDogFraternity</code> 中应该用到

下同

"到目前为止,你已经可以单独给 <code>prototype</code> 添加属性了:",
"<blockquote>Bird.prototype.numLegs = 2;</blockquote>",
"This becomes tedious after more than a few properties.",
"这将在添加许多属性的时候变得单调乏味的。",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

变得单调乏味的 => 变得单调乏味

"这将在添加许多属性的时候变得单调乏味的。",
"<blockquote>Bird.prototype.eat = function() {<br>&nbsp;&nbsp;console.log(\"nom nom nom\");<br>}<br><br>Bird.prototype.describe = function() {<br>&nbsp;&nbsp;console.log(\"My name is \" + this.name);<br>}</blockquote>",
"A more efficient way is to set the <code>prototype</code> to a new object that already contains the properties. This way, the properties are added all at once:",
"一种更有效的方法就是给对象的 <code>prototype</code> 设置为一个已经包含了属性的新对象。这样一来,所有属性都可以一次性被添加进来:",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

删掉“被”

"<blockquote>Bird.prototype = {<br>&nbsp;&nbsp;numLegs: 2, <br>&nbsp;&nbsp;eat: function() {<br>&nbsp;&nbsp;&nbsp;&nbsp;console.log(\"nom nom nom\");<br>&nbsp;&nbsp;},<br>&nbsp;&nbsp;describe: function() {<br>&nbsp;&nbsp;&nbsp;&nbsp;console.log(\"My name is \" + this.name);<br>&nbsp;&nbsp;}<br>};</blockquote>",
"<hr>",
"Add the property <code>numLegs</code> and the two methods <code>eat()</code> and <code>describe()</code> to the <code>prototype</code> of <code>Dog</code> by setting the <code>prototype</code> to a new object."
"通过给 <code>prototype</code> 设置为新对象的方法,给 <code>Dog</code> 构造函数的 <code>原型</code> 上添加一个属性 <code>numLegs</code> 和两个方法 <code>eat()</code> <code>describe()</code>"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在……上


和两个方法 <code>eat()</code> 、<code>describe()</code>。 =>
以及两个方法:<code>eat()</code> 和 <code>describe()</code>。

@S1ngS1ng S1ngS1ng added the need update Use when a translation (?) PR has been reviewed and needs to address comments label Jul 27, 2018
Copy link
Contributor

@S1ngS1ng S1ngS1ng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 👍

@S1ngS1ng S1ngS1ng added :shipit: ship it Use when a translation (?) PR is ready for shipping and removed need update Use when a translation (?) PR has been reviewed and needs to address comments ready for review Use when a translation (?) PR is ready for review labels Jul 27, 2018
@huluoyang
Copy link
Contributor

🎉 恭喜小罗的第一个PR成功进入仓库,keep moving!

@huluoyang huluoyang merged commit 0b410cf into FreeCodeCampChina:translate Jul 28, 2018
demongodYY pushed a commit to demongodYY/challenges that referenced this pull request Jul 30, 2018
* finish 50% translation of object-oriented-programming

* modify translate

* change 对象 to  物体 in the real life.
LynnLian pushed a commit to LynnLian/challenges that referenced this pull request Jul 30, 2018
* finish 50% translation of object-oriented-programming

* modify translate

* change 对象 to  物体 in the real life.
SSShooter pushed a commit to SSShooter/challenges that referenced this pull request Sep 7, 2018
* finish 50% translation of object-oriented-programming

* modify translate

* change 对象 to  物体 in the real life.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:shipit: ship it Use when a translation (?) PR is ready for shipping

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants