Understandability tips 易于理解
Be consistent. If you do something a certain way, do all similar things in the same way.
Use explanatory variables.
Encapsulate boundary conditions. Boundary conditions are hard to keep track of. Put the processing for them in one place.
Prefer dedicated value objects to primitive type.
Avoid logical dependency. Don't write methods which works correctly depending on something else in the same class.
Avoid negative conditionals.
保持一致。使用同样的方法做类似的事情。
使用解释性变量。
封装边界条件。边界条件很难跟踪,在一处处理它们。
VO(值对象)较原子类型更好。
避免逻辑依赖。一个方法不应依赖于该类中其他方法的正确调用。
避免使用否定条件。
Last updated
Was this helpful?