Chapter Two. Communication and the Use of Language
A project faces serious problems when its language is fractured. Domain experts use their
jargon while technical team members have their own language tuned for discussing the domain
in terms of design.
The terminology of day-to-day discussions is disconnected from the terminology embedded in
the code (ultimately the most important product of a software project). And even the same
person uses different language in speech and in writing, so that the most incisive
expressions of the domain often emerge in a transient form that is never captured in the
code or even in writing.
Translation blunts communication and makes knowledge crunching anemic.
Yet none of these dialects can be a common language because none serves all needs.
当用于交流的语言出现断层的时候,项目将会面临一系列严重的问题。域专家们与技术团队自
说自话。
日常讨论所用的术语不再与代码(它们会成为软件项目的重要部分)中的术语相联系。甚至同
一个人会在交流中和在记录中所用的术语不相一致,以至于问题域中那些重要的表达方式出现得如此短
暂进而使它们无法被捕获到代码中去甚至无法被记录下来。
Use the model as the backbone of a language. Commit the team to exercising that language
relentlessly in all communication within the team and in the code. Use the same language in
diagrams, writing, and especially speech.
Iron out difficulties by experimenting with alternative expressions, which reflect
alternative models. Then refactor the code, renaming classes, methods, and modules to
conform to the new model. Resolve confusion over terms in conversation, in just the way we
come to agree on the meaning of ordinary words.
Recognize that a change in the UBIQUITOUS LANGUAGE is a change to the model.
Domain experts should object to terms or structures that are awkward or inadequate to
convey domain understanding; developers should watch for ambiguity or inconsistency that
will trip up design.
把模型作为通用语言的核心。推动整个团队在各种各样的交流中以及在编码中严格的实践这种
语言。在图表、记录特别是谈话中统一交流方式。
通过选择性的表达方式,即那些对应不同模型的表达方式来消除通用语言中的难点。然后重构
代码,重新命名那些类、方法模块,使它们和新的模型相一致。我们对那些常用词汇的理解渐渐的达成
一致,并以此来解决交谈期间的那些混淆。
要知道,对于通用语言的任何变化都是对模型的变化。
域专家们应当积极反对那些尴尬的或者不能充分传达域概念的术语,开发者应当时时留意含义不
明确或者有矛盾的地方,这些地方会给设计埋下隐患。
Play with the model as you talk about the system. Describe scenarios out loud using the
elements and interactions of the model, combining concepts in ways allowed by the model.
Find easier ways to say what you need to say, and then take those new ideas back down to
the diagrams and code.
当你谈论系统的时候,多多使用模型。大声地使用模型所提供的那些元素和交互方式描述情节
,以模型所接受的方式联结域中的概念。尽可能简单的表达你所要表达的东西,然后反过头来把这些思
路转变为图表和代码。