ClownfishYang commented on a change in pull request #394:
URL: https://github.com/apache/flink-web/pull/394#discussion_r525726673
##########
File path: contributing/code-style-and-quality-common.zh.md
##########
@@ -137,186 +137,182 @@ the main path
```
-## 4. Design and Structure
+## 4. 设计和结构
-While it is hard to exactly specify what constitutes a good design, there are
some properties that can serve as a _litmus test_ for a good design. If these
properties are given, the chances are good that the design is going into a good
direction. If these properties cannot be achieved, there is a high probability
that the design is flawed.
+虽然很难确切地指定一个好的设计是由什么构成的,但是有一些属性可以作为好的设计的试金石。如果设计上拥有这些属性,那么就有可能得到好的发展。否则,设计就很有可能存在缺陷。
-### Immutability and Eager Initialization
+### 不变性(Immutability)和急切初始化(Eager Initialization)
-1. Try to use immutable types where possible, especially for APIs, messages,
identifiers, properties, configuration, etc.
-2. A good general approach is to try and make as many fields of a class
`final` as possible.
-3. Classes that are used as keys in maps should be strictly immutable and only
have `final` fields (except maybe auxiliary fields, like lazy cached hash
codes).
-4. Eagerly initialize classes. There should be no `init()` or `setup()`
methods. Once the constructor completes, the object should be usable.
+1. 尽可能尝试使用不可变类型,尤其是 API、消息、标识符、属性、配置等等。
+2. 一个好的通用方法是尽可能地将类中的字段设置为 `final`。
+3. 在 map 中作为 key 的类应该是严格不可变的,并且只有 final 字段(可能除了辅助的字段,如延迟缓存的 hash code)。
Review comment:
```suggestion
3. 在 map 中作为 key 的类应该是严格不可变的,并且只有 final 字段(可能除了辅助的字段,如延迟缓存的 key)。
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]