领域特定语言 (DSL) 和领域驱动设计 (DDD)
领域特定语言(DSL)和领域驱动设计(DDD)之间有什么区别和相似之处?
What is the differences and similarities between Domain Specific Languages (DSL) and Domain Driven Design (DDD)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(10)
DDD 的一个要素可以被视为开发通用语言以与利益相关者讨论该领域的能力。 对于那些既明确又可能可执行的 UL 子集,您可以选择使用内部或外部 DSL 来实现它们。
这是我在 DomainDriven 网站上讨论此问题的视频:
http://domaindrivendesign.org/library/bell_gitlevich_2009
最美好的祝愿,
彼得
One element of DDD can be seen as the ability to develop Ubiquitous Languages for talking with stakeholder about the domain. For the subset of those UL's that are both unambiguous and potentially executable, you may choose to implement them using an internal or external DSL.
Here's a video of me discussing this on the DomainDriven site:
http://domaindrivendesign.org/library/bell_gitlevich_2009
Best Wishes,
Peter
维基百科对 DSL 有一个非常明确的定义:
这可以实现为一组遵循某种一致模式的类、一些奇特的 C++ 模板魔法,或者解释自由文本输入以执行您想要的操作的编译器/解析器。
Wikipedia has a pretty clear definition for DSL:
This can be implemented as a set of classes following some consistent pattern, some fancy C++ template magic, or a compiler/parser that interprets free text input to do what you want.
我认为它们在某种程度上是相关的(正如克里斯托夫所说),但却是两个完全不同的方面。 我什至不会驳回乔普的声明。
有关 DSL 的详细信息,请参阅 Martin Fowler 的 DSL 页面集(正在进行中),您可以从 示例 或 定义。 另一本值得一读的文章是他的 QandA。
DDD 基于领域模型,通常至少比 DSL 高一级抽象级别。 两者都可以独立存在,正如 Christophe 已经说过的,它们都可以在同一个项目中使用。
I think they are somehow related (as Christophe put it), but two totally different aspects. I wouldn't even dismiss jop's statement.
For very well written information on DSLs refer to Martin Fowler's set of pages on DSLs (work in progress), you may start with the example, or the definition. Another good read is his QandA.
DDD is based on the domain model and usually at least one abstraction level higher than the DSL. Both can exist without the other, and as Christophe already said, they can both be used in the same project.
区别在于,一个是使用领域特定语言 (DSL) 而不是通用语言来构建系统的方法,另一个是设计和构建系统的架构方法 (DDD)。
相似之处在于它们都专注于特定领域。
The differences, one is an approach to building systems using a Domain Specific Language language (DSL) instead of a General Purpose Language and the other is an architectural approach (DDD) to designing and building systems.
The similarity is that they both focus on the specific domain.
维基百科(https://en.wikipedia.org/wiki/Domain-driven_design)有一个很好的答案:
Wikipedia (https://en.wikipedia.org/wiki/Domain-driven_design) has a good answer:
Markus Voelter 在他的 DSL Engineering 书 中提供了很好的答案2.5.2 思考和沟通工具:
Nice answer is provided by Markus Voelter in his DSL Engineering book, paragraph 2.5.2 A Thinking and Communication Tool:
领域驱动设计(DDD)是一种思考和交流问题及其解决方案的方式。
领域特定语言(DSL)是一种编写代码的方式。
它们很相似,因为它们都以“域”一词开头。 我想就是这样。 :-)
Domain Driven Design (DDD) is a way of thinking and communicating about the problems and its solutions.
Domain Specific Language (DSL) is a way of writing code.
They're similar because they both start with the word "domain". That's it, I guess. :-)
领域驱动设计强调问题域在为所设计的系统创建基本词汇、概念和对象模型时的作用。
领域特定语言是一种用于指定或实现系统特定部分的符号,面向该领域从业者的需求(即最小化大多数编程或规范语言的“程序员语言”方面)。
Domain-Driven Design emphasizes the role of the problem domain as you create the fundamental vocabulary, concepts, and object model for the system being designed.
A Domain-Specific Language is a notation for specifying or implementing specific parts of the system, oriented to the needs of the practitioner in that domain (i.e. minimizing the "programmerese" aspects of most programming or specification languages).
我认为它们在某种程度上是相关的,而不仅仅是“域”这个词。 一旦你有了一个好的(领域驱动的)设计,它肯定会有助于创建一个可靠的 DSL。
“DDD 并不特别要求使用 DSL,尽管它可以用来帮助定义 DSL。” - 维基百科
I would argue that they are somehow related and not only by the word "domain". Once you have a good (domain-driven) design, it will surely help in creating a solid DSL.
"DDD does not specifically require the use of a DSL, though it could be used to help define a DSL." - Wikipedia
我想两者的主要焦点都是减少编程中的噪音,DDD 作用于语义噪音,DSL 作用于句法噪音。
这些可能有助于理解我的观点:
http://fragmental.tw/2009/03 /12/expessive-design-slides/
http://fragmental.tw/2008/04/20/domain-specific-languages-and-video-games/
I guess both have as its main focus reducing the noise in programming, DDD acts on semantic noise and DSLs in syntactic noise.
These may help understand my opinion:
http://fragmental.tw/2009/03/12/expessive-design-slides/
http://fragmental.tw/2008/04/20/domain-specific-languages-and-video-games/