Skip to content
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

值类型导向编程 #4909

Merged
merged 4 commits into from
Jan 2, 2019
Merged

值类型导向编程 #4909

merged 4 commits into from
Jan 2, 2019

Conversation

nanjingboy
Copy link
Member

译文翻译完成,resolve #4901

@Bruce-pac
Copy link
Contributor

@leviding 校对认领

@fanyijihua
Copy link
Collaborator

@Bruce-pac 好的呢 🍺


2. 无继承问题

通过继承来重用代码的方式是脆弱的。继承还会跟接口实现耦合,这使得代码重用变得更加困难。这是它的特性,但即使是使用面向对象的程序员也会告诉你他更喜欢”组合而不是继承“。
Copy link
Contributor

Choose a reason for hiding this comment

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

『继承还会跟接口实现耦合』=> 『继承还将接口与实现耦合在一起』


2. 无继承问题

通过继承来重用代码的方式是脆弱的。继承还会跟接口实现耦合,这使得代码重用变得更加困难。这是它的特性,但即使是使用面向对象的程序员也会告诉你他更喜欢”组合而不是继承“。
Copy link
Contributor

Choose a reason for hiding this comment

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

@@ -83,7 +83,7 @@ extension Diagram : Drawable {
}
```

This made it possible to define different renderers that worked easily with the given types. A main selling point was the ability to define a test renderer, which let you verify drawing by comparing strings:
这使得为指定类型定义不同的、可轻松工作的渲染器成为了可能。一个最主要的卖点是定义测试渲染器的能力,它允许你通过比较字符串来验证绘制:
Copy link
Contributor

@Bruce-pac Bruce-pac Jan 1, 2019

Choose a reason for hiding this comment

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

『这使得为指定类型定义不同的、可轻松工作的渲染器成为了可能』=> 『这使得定义根据给定类型并能为此轻松工作的各种渲染器变的可能』

@leviding
Copy link
Member

leviding commented Jan 2, 2019

@nanjingboy 可以修改啦

@leviding leviding added the enhancement 等待译者修改 label Jan 2, 2019
@nanjingboy
Copy link
Member Author

@leviding 修改完成

@Bruce-pac
Copy link
Contributor

@nanjingboy 还有一个没改,标点符号

@nanjingboy
Copy link
Member Author

@Bruce-pac 不好意思,没注意

@leviding leviding merged commit 5aa7790 into xitu:master Jan 2, 2019
@leviding
Copy link
Member

leviding commented Jan 2, 2019

@nanjingboy 已经 merge 啦~ 快快麻溜发布到掘金然后给我发下链接,方便及时添加积分哟。

掘金翻译计划有自己的知乎专栏,你也可以投稿哈,推荐使用一个好用的插件
专栏地址:https://zhuanlan.zhihu.com/juejinfanyi

@leviding leviding added 翻译完成 and removed enhancement 等待译者修改 正在校对 labels Jan 2, 2019
@nanjingboy nanjingboy deleted the translation/value-oriented-programming branch January 2, 2019 02:05
@nanjingboy
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

值类型导向编程
4 participants