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

真相在代码中 #1617

Merged
merged 9 commits into from
May 12, 2017
Merged

真相在代码中 #1617

merged 9 commits into from
May 12, 2017

Conversation

loveky
Copy link
Contributor

@loveky loveky commented May 3, 2017

@loveky
Copy link
Contributor Author

loveky commented May 3, 2017

@sqrthree 翻译完成,请求校对

@linhe0x0 linhe0x0 self-requested a review May 4, 2017 02:10
@linhe0x0 linhe0x0 mentioned this pull request May 4, 2017
@sunui
Copy link
Contributor

sunui commented May 4, 2017

@sqrthree 校对认领

@linhe0x0
Copy link
Member

linhe0x0 commented May 4, 2017

@sunui 好的

@aladdin-add
Copy link
Member

建议:标题可否改成:源码面前,了无秘密。(from 侯捷)

Copy link
Contributor

@sunui sunui left a comment

Choose a reason for hiding this comment

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

简洁明快 翻译的很好。 标题建议 : 真相就在代码指之中


![](https://cdn-images-1.medium.com/max/800/1*Fw8F2fRNVfkcE-0VGyDZhQ.png)

[shoppingapp](https://github.com/bertilmuth/requirementsascode/tree/master/requirementsascodeexamples/shoppingappjavafx) model, example of [requirementsascode](https://github.com/bertilmuth/requirementsascode)
[shoppingapp](https://github.com/bertilmuth/requirementsascode/tree/master/requirementsascodeexamples/shoppingappjavafx) 模型, [requirementsascode](https://github.com/bertilmuth/requirementsascode) 的示例代码
Copy link
Contributor

Choose a reason for hiding this comment

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

中文逗号


> – Robert C. Martin, [Clean Code](https://www.amazon.de/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882)
> – Robert C. Martin, [代码整洁之道](https://www.amazon.de/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882)
Copy link
Contributor

Choose a reason for hiding this comment

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

中文逗号 和破折号 书名号是不是也要加上


*X*: We can’t go on with feature *foo*.
**X**: 我们不能继续开发**foo**特性了。
Copy link
Contributor

Choose a reason for hiding this comment

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

中英文之间空格


There are techniques for that. [Pair programming](https://en.m.wikipedia.org/wiki/Pair_programming) is a good one. Or you sit down with other developers. You walk them through the code you have written.
有这方面的技术。[结对编程](https://en.m.wikipedia.org/wiki/Pair_programming)就是一个不错的选择。或者是和其他开发人员坐下来,一起过一遍你写的代码。
Copy link
Contributor

Choose a reason for hiding this comment

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

技术 => 技巧


Clean code gives you the right *words*.
整洁代码带给你正确的**单词**。
Copy link
Contributor

Choose a reason for hiding this comment

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

单词 => 言辞

Copy link
Contributor Author

Choose a reason for hiding this comment

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

想了想,"用词"是不是更合适? 言辞 有点太正式了?

Copy link
Contributor

Choose a reason for hiding this comment

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

好呀


So if several developers use Rails, they know which part of the code to look at for certain parts of their story.
因此,如果多个开发人员使用Rails,他们就知道在哪里能找到和故事中特定部分相关的代码。
Copy link
Contributor

Choose a reason for hiding this comment

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

中英文之间空格


They could find out what is missing when sharing their understanding. Then, they could agree on further conventions on where to put which part of their story.
他们可以在分享他们的理解时找出缺失的东西。然后,他们就可以进一步的就约定在哪里放置故事的模块达成一致。
Copy link
Contributor

Choose a reason for hiding this comment

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

分享他们的理解 => 分享他们的见解

- But the runner only reacts if the user is at the right position of the *flow* and the step’s *condition* is fulfilled. For example, the runner only reacts to the “EnterPaymentDetails“ event if the user has entered the shipping information right before.
- The *systemreaction* is a single method. The method’s body is responsible for coordinating the components to realize the step, as described in chapter 2.
- Chapter 3 is out of scope of requirementsascode. It is left up to the application. That makes requirementsascode compatible with arbitrary software designs.
- UssCaseModel 实例用于定义**行为者**,**用例**,它们的**流程**以及**步骤**。它讲述故事的第一章。在本文的开头你能找到一个这种模型的例子。
Copy link
Contributor

Choose a reason for hiding this comment

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

UssCaseModel => UseCaseModel

- 用例模型配置 UseCaseModelRunner 实例。每个用户都有自己的运行程序,因为每个用户选择执行的用例路径可能不同。
- 运行程序通过调用后端的**系统响应**来响应前端的**用户事件**。前端只能通过运行程序和后端通信。
- 但是运行程序只有当用户在**流程**中的正确位置且满足步骤的**条件**时才会响应用户。例如:运行程序只有在用户已经输入了配送信息之后才会响应“进入支付详情页”事件。
- **system reaction**是一个单例方法。方法内部负责协调不同组件以实现该步骤,就像在第二章中描述的那样。
Copy link
Contributor

Choose a reason for hiding this comment

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

中英文空格


You can [clone](https://github.com/bertilmuth/requirementsascode) the project and try it out yourself.
你可以[克隆](https://github.com/bertilmuth/requirementsascode)这个项目并亲自尝试一下。
Copy link
Contributor

Choose a reason for hiding this comment

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

clone 和下文的 contribute 建议不翻译

Copy link
Contributor Author

Choose a reason for hiding this comment

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

contribute 不翻译是不是读起来就不通顺了。

也可以contribute在代码中记录真相?

@sunui
Copy link
Contributor

sunui commented May 4, 2017

@sqrthree @loveky 校对完成

@yzgyyang
Copy link

yzgyyang commented May 7, 2017

@sqrthree 认领

@linhe0x0
Copy link
Member

linhe0x0 commented May 8, 2017

@yzgyyang 好哒

@linhe0x0
Copy link
Member

@yzgyyang 别忘了来校对啊

Copy link

@yzgyyang yzgyyang left a comment

Choose a reason for hiding this comment

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

@loveky @sqrthree 校对完成。翻译很棒!有一个总体的建议不知道对不对:原文里大量用短句,翻译过来句号特别多,有很多地方不必断句。建议改为逗号。


![](https://cdn-images-1.medium.com/max/800/1*Fw8F2fRNVfkcE-0VGyDZhQ.png)

[shoppingapp](https://github.com/bertilmuth/requirementsascode/tree/master/requirementsascodeexamples/shoppingappjavafx) model, example of [requirementsascode](https://github.com/bertilmuth/requirementsascode)
[shoppingapp](https://github.com/bertilmuth/requirementsascode/tree/master/requirementsascodeexamples/shoppingappjavafx) 模型,[requirementsascode](https://github.com/bertilmuth/requirementsascode) 的示例代码

Choose a reason for hiding this comment

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

建议翻译一下'shopping app'?个人观点。


The [Agile Manifesto](http://agilemanifesto.org/) values “working software over comprehensive documentation.
[敏捷宣言](http://agilemanifesto.org/)中指出“可工作的软件胜过繁琐的文档。

Choose a reason for hiding this comment

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

。” => ”。


In contrast, code *always* reflects the software’s behavior. It defines it.
另一方面,代码**始终**都能表达软件的行为。因为正是它定义了这些行为。

Choose a reason for hiding this comment

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

"另一方面" => "相反"


Code comments, and external specifications, document the software’s behavior as well. But they may not get updated when the code changes. Then they stop reflecting the software’s behavior soon.
代码注释,外部规范也在记录软件的行为。但是当代码被修改时它们可能不会被同步更新。然后它们很快就不再能表达代码的行为了。

Choose a reason for hiding this comment

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

"行为。但是" 这里的句号也许可以改为逗号?


As a user of software, I want to [reach a desired outcome](https://medium.freecodecamp.com/nobody-wants-to-use-software-a75643bee654?source=linkShare-a74297325869-1489339708). For example, I want to own a new pair of gloves to keep my fingers warm in winter.
作为一个软件的用户,我想要[达到期望的目的](https://medium.freecodecamp.com/nobody-wants-to-use-software-a75643bee654?source=linkShare-a74297325869-1489339708)。比如,我想拥有一双新手套以便我的手指在冬天可以保持温暖。

Choose a reason for hiding this comment

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

“以便我的手指在冬天可以保持温暖” =>“在冬天可以给我的手保暖”


So I go online and see there is a new online shop specialized in gloves. The shop’s website lets me buy gloves. The “basic flow” (also called “happy day scenario”) of the use case could look like this one:
因此我上网寻找并发现了一家新开的线上手套专卖店。该店铺的网站可以让我购买手套。“基本流程”(也被成为“正常用例”)大概是这样的:

Choose a reason for hiding this comment

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

“寻找并发现” => "找到"
“该店铺的网站可以让我购买手套” => "我可以在他们的网站上买手套"
"成为" => "称为"

- 系统以一个空购物车开始。
- 系统展示一个手套的列表。
- 我添加喜欢的手套到购物车。系统将这些手套加入到我的订单中。
- 我选择结账

Choose a reason for hiding this comment

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

标点符号


It also bears the risk that developers tell too many different stories. Even for the same product. That makes it harder than necessary to understand code that somebody else has written.
这也承担了由开发人员讲述太多不同故事(哪怕是针对同一个产品)带来的风险。使得理解其他人编写的代码变得更困难了。

Choose a reason for hiding this comment

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

可以改为逗号


To learn whether the approach scales, I tried it on an application with several thousand lines of code. It worked. I tried it on smaller applications as well.
为了了解这种方法是否具有可扩展性,我尝试在一个有数千行代码的项目中使用。被证明是有效的。我也在一些更加小型的应用中尝试过。

Choose a reason for hiding this comment

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

“被证明是有效的”前可以改为逗号

@loveky
Copy link
Contributor Author

loveky commented May 11, 2017

感谢 @yzgyyang 的校对。 @sqrthree 已经修改完毕。

Copy link
Member

@linhe0x0 linhe0x0 left a comment

Choose a reason for hiding this comment

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

两个小问题辛苦改一下哈。


#### So what are the *parts* of a use case? ###
#### 那么一个用例由哪些零件构成呢?####
Copy link
Member

Choose a reason for hiding this comment

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

image


#### To understand the code, you need an easy way to know several things. ###
#### 要理解代码,你需要一个简单方法来了解几件事情。####
Copy link
Member

Choose a reason for hiding this comment

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

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

好尴尬,github不支持h4标签啊,这种一般要怎么处理呢

Copy link
Member

Choose a reason for hiding this comment

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

支持前后加 ### 号,但是要和内容之间保持一个空格。原句中的句号因为是全角符号,容易误解为已经存在空格了,实际是没有的。

@loveky
Copy link
Contributor Author

loveky commented May 12, 2017

@sqrthree 改好啦

@linhe0x0 linhe0x0 merged commit 1a8947e into xitu:master May 12, 2017
@linhe0x0
Copy link
Member

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

@loveky
Copy link
Contributor Author

loveky commented May 12, 2017

已发布 https://juejin.im/post/59152d17da2f60005dd0ae77

感谢 @sunui @yzgyyang @sqrthree 各位的帮助

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.

5 participants