`
pengchua
  • 浏览: 150670 次
  • 性别: Icon_minigender_1
  • 来自: 上海
文章分类
社区版块
存档分类
最新评论

读《Domain-Driven Design Quickly》笔记

阅读更多
Domain-Driven Design Quickly 这书很好,
下载地址:http://www.infoq.com/minibooks/domain-driven-design-quickly
判断是否是领域逻辑的原则:就是这个逻辑动作是否有明确的业务上的含义,或者说是否是业务相关的,而不仅仅是技术相关的。

只有将技术实现手段从领域问题中剥离才能保证领域本身的精炼,保证程序员可以把精力集中到领域问题本身上来,而不会满脑子都是技术实现手段。

按照Eric的表述,通常将领域中的组成角色分为以下五种:
实体(Entity):拥有唯一标识的对象。
值对象(Value Object):没有唯一标识的对象。
工厂(Factory):定义创建实体的方法。
仓储(Repository):管理实体的集合并封装其持久化过程。
服务(Service):实现不能指派或封装在一个单一对象上的操作。

 a domain model is not a particular diagram;  it  is  the  idea  that  the diagram  is  intended  to
convey.

The previous chapters underscored the importance of an approach to software development that is centered on the business domain.(上一章节强调软件开发方法的重点是以业务领域为中心。)

It  is important  to choose a model which can  be  easily  and  accurately  put  into  code. 选择一种容易且能精确地转化成代码的模型是非常重要的。

A  common  architectural  solution  for  domain-driven  designs contain four conceptual layers:
    1.User Interface(Presentation Layer);
    2.Application Layer:This  is  a  thin  layer  which  coordinates (调整) the  application activity.  It does not  contain business  logic.  It does not hold  the  state  of  the  business  objects,  but  it  can  hold the state of an application task progress.
    3.Domain Layer:This  layer contains  information about  the domain. This is  the  heart  of  the  business  software.  The  state  of business  objects  is  held  here.  Persistence  of  the business objects and possibly their state is delegated to the infrastructure layer.
    4.Infrastructure Layer :This  layer acts as a supporting  library  for all  the other layers.  It  provides communication  between  layers, implements  persistence  for  business  objects,  contains
supporting libraries for the user interface layer, etc.

There  are  cases when we  need  to  contain  some  attributes  of  a domain element. We are not interested in which object it is, but what attributes  it has. An object  that  is used  to describe certain aspects of a domain, and which does not have identity, is named Value Object.(有些情况下,领域元素需要包含一些属性。然后我们关注的不是它是哪个对象,而是这个象所拥有的属性。被用来描述一个领域某一方面,而且没有标识的对象叫值对象。)
Value Objects  can  contain  other Value Objects,  and  they  can even contain references  to Entities.(值对象中也可包含其他值对象,甚至还可包括对实体的引用。)
 

分享到:
评论
1 楼 lonelybug 2009-09-16  
我到现在还是对,不关心是那个对象,而是这个对象所拥有的属性有点迷惑不解。

有的时候,有的value object还是有局部的id的用来做多个VO之间的区别之用的。

水能给详细解释一下,谢了。

相关推荐

Global site tag (gtag.js) - Google Analytics