gpt4 book ai didi

c# - 是否可以一起使用 DDD 和 BDD?

转载 作者:太空狗 更新时间:2023-10-29 22:43:44 26 4
gpt4 key购买 nike

我喜欢使用 DDD 实现的中间开发。开发是由领域驱动的,领域是应用程序中最坚实的部分。我们不依赖于基础设施、持久性和展示。听起来不错。但它没有商业值(value)。

以业务为中心的 BDD 和由外向内的开发来了。我们没有前期领域设计(选择实体、值(value)对象、聚合)。我们获取用户故事,编写一些场景并逐一实现。我们从应用程序中变化最大的部分开始开发——从演示开始。我讨厌编写脆弱的验收测试。你呢?

所以,如果这里有人有以 BDD 风格应用 DDD 的成功案例,请与我分享一些 :)

  1. 您是否编写那些脆弱的测试以供演示?
  2. 在为已实现的用户故事创建部分领域之前,您是否预先进行了一些设计?或者您在实现故事后重构 DDD 模式?

任何帮助将不胜感激。谢谢!

最佳答案

我提供 Dan North and myself (请原谅车头灯里的兔子,这是我的第一个视频)正在接受 Eric Evans 的一位同事关于 BDD 和 DDD 的采访。

您还可以先睹为快,预览一下我正在写的 BDD 书中第一章草稿的一部分(希望 Dan 也有):

As another effect, discussing the scenarios without any technical words, in business language, allowed the developers to pick up that language. They then carried that language into their codebase, implementing classes named after elements of the business domain, methods named after capabilities of those elements, and properties and variables named after their real-life properties and sub-elements.

This use of business terminology in code is referred to as the ubiquitous language in Eric Evans' book, "Domain Driven Design". Eric suggests that when developers start to code in a language which matches business stakeholders' terminology, conversations become fluid, without the need for developers (or analysts as a proxy) to translate back and forth from technical details to domain concepts. The code becomes more readable and easier for newcomers to understand. The value of each object in the system becomes more obvious, as well as the path by which it provides its value back to the user so that the user could provide value to the business.

JBehave introduced something new. Not only were the developers using business domain language; they were now using a language that the business understood to describe software terminology. Instead of words like test, acceptance test, act, arrange, assert, red bar and green bar, developers were talking about examples, scenarios, contexts, events, outcomes and behaviour.

JBehave, and BDD, had introduced a ubiquitous language for software development itself.

希望这表明 BDD 和 DDD 确实可以很好地协同工作。欢迎所有反馈,除了我的着装品味。

编辑:您说得对,域非常可靠。这就是为什么我们专注于风险更大的东西,如演示和基础设施,并讨论我们对领域使用场景的理解。在我们通过获得反馈之前,我们无法获得关于我们对域的理解的反馈 - 但这并不能阻止我们寻求理解。

关于c# - 是否可以一起使用 DDD 和 BDD?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7147987/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com