标签:
-------------------------------------之前园子里面有人翻译过,在家闲的没事又整理了一遍。
当我们开始一个传统的商业应用程序时我们通常都做些什么?我们阅读说明和查找相应的功能,我们分解任务,大多数情况分解的目标是形成可行性分析和工作计划。我们进行可行性分析,给团队人员分配任务。在团队领导和其他开发人员的协作下我们设计数据框架,我们开始编码。
Think about all of the projects you have worked last few years in the traditional approach. Did you ever face any of the issues below?
But when you design in bottom-up approach, you first design for the granular functionalities, and you have little or no knowledge how this functionality will be used from the Top level and how the Top level functionalities will actually look like.
Have you ever heard that a developer of your team is talking like he does not have the domain knowledge of the whole application? Perhaps yes! I think you can understand the reason. Cause, the design of the application does not represent the domain of the system. And so, developers know only the portions they worked. This is Sad! Isn’t it?
So, is traditional approach – “Designing the application starting from database” a throw away concept? Not really! But if you have a complex application to develop, this bottom-up design approach does not dictate you to come up with a proper object oriented design.
我确定你已经经常的面试以上这些问题,但是你知道为什么吗?原因是,传统的开发模式不会引导我们自下而上的方式去设计系统。相反它会诱导我们自下而上的方式去设计系统,可见,当我们设计系统时需要知道应用程序想要做什么?什么是客户想要实现的目标?然而,从顶层目标来看你拿出不同的小功能来最终将实现所有的用户来实现最终顶层的目标。
当我利用自下而上的方式设计时,你第一个设计的是粒状的功能模块,你很少知道或不知道这个功能从顶层如何被使用和顶层的功能实际看起来怎么使用。
你是否听说过你团队开发成员的谈话,就像他不具备整个应用程序的领域知识?或许是的,我想你应该知道原因了,理由,应用程序的设计不代表系统的领域。因此,开发人员仅仅只知道自己工作分配的部分,这是很可悲的,不是吗?
那么传统开发模式-“应用程序设计从数据库开始”一个被遗弃的概念?并不是的,但是假如你开发复杂的应用程序,这种自下而上的开发设计模式对你来说并不是真正意义的面向对象的设计。
What is the solution then?
The solution is DDD (DOMAIN DRIVEN DESIGN).
In this article I will try to avoid becoming too technical, rather I will try to go through different concepts of DDD being close to the real world. I will try not to show any code here. Because I believe if you understand the concept and starts thinking in DDD way, implementation is easy. The toughest part is to tune your thinking process!
Do you get a feeling what is domain from this definition? Can you tell what is the domain of the project you are working on at this moment? Can you tell what is the domain of the famous website YouTube?
In this article I would like to go through a real world example to give you the feeling how to start analyzing your project driven by your domain. This example may not be related with application development but as the goal is to tune our thinking top to bottom manner, it will be useful. But again, we will go through the technical terms of DDD too!
Let’s say you are engaged to design a building. The requirement is:
What is your domain here?
The domain is Building(?). It could be. But note that, if you consider Building as your domain you may miss few granular details for your requirement. The building you are going to design must have design for apartments where people will live. So, a general term “Building” can make us miss few details. So, we may narrow down our domain to “Residential Building”.
Now, when you talk about your work with engineers and also with the people who engaged you to design the building, the term “Residential Building” is more meaningful for everybody concerned. Did you mark very small change in language here? The contractor is telling you to design a building where there will be 4 apartments in each of the 6 floors. Now, if you send an engineer to the site telling him we will need to construct a building there, they might not consider many attributes that a residential building must have. On the other hand if you use the term “Residential Building”, most likely he will come with a valid analysis.
This is how we come to an “Ubiquitous Language”.
Repository commonly refers to a location for storage, often for safety or preservation.
- Wikipedia
1、第一步你有一个接口--IRepository 必须通用2、你将有一个抽象类实现IRepository接口。3、你将有一个INhRepository接口用于你的持久化机制它将继承IRepository4、你将有一个实现INhRepository的像:”NhRepository“5、最好你可以有一个通用的类实现Repository默认实现Respository的所有通用方法6、像NHGenericRepository继承NhRepository和实现IGenericNhRepository7、你有一个特别的仓储用于你的聚合根,扩展NHGenericRepository8、你的应用程序将使用服务定位器找到你应用程序将使用的仓储
In this article I have tried to introduce the basic concepts and terminologies of Domain Driven Design with examples of real world. The goal was to make you feel comfortable with DDD world. But really developing applications with DDD is a big challenge. The more you love and practice DDD concepts while you design your object model, the more accuracy you will gain in your design. As I said before the most important thing is, you must think in Domain Driven Way. If you don‘t you will hugely suffer when your application is a real complex one.
标签:
原文地址:http://www.cnblogs.com/savior/p/4301872.html