发帖    主题    评论    推荐    标签    作者    订阅    查搜    注册   登陆   关注
 
面向对象 设计模式 领域驱动设计 企业架构 框架 开发教程 微服务 CQRS 扩展性 并发编程 事件溯源 分布式 SOA

Martin Fowler DDD_Aggregate

    
2013-12-15 15:58
赞助商链接

Aggregate is a pattern in Domain-Driven Design. A DDD aggregate is a cluster of domain objects that can be treated as a single unit. An example may be an order and its line-items, these will be separate objects, but it's useful to treat the order (together with its line items) as a single aggregate.

An aggregate will have one of its component objects be the aggregate root. Any references from outside the aggregate should only go to the aggregate root. The root can thus ensure the integrity of the aggregate as a whole.

Aggregates are the basic element of transfer of data storage - you request to load or save whole aggregates. Transactions should not cross aggregate boundaries.

DDD Aggregates are sometimes confused with collection classes (lists, maps, etc). DDD aggregates are domain concepts (order, clinic visit, playlist), while collections are generic. An aggregate will often contain mutliple collections, together with simple fields. The term "aggregate" is a common one, and is used in various different contexts (e.g. UML), in which case it does not refer to the same concept as a DDD aggregate.

是不是说一个聚合根在数据库中是一个表

2013-12-15 17:26

聚合是DDD一个模式,一个DDD聚合是一群领域对象,被看成一个单独单元。订单和订单条目是一个典型例子,这是两个分离的对象,但是作为一个整体成一个聚合,聚合中会有一个组件作为聚合根,任何聚合外面的引用只能引用聚合根,聚合根这样才能确保整个聚合的整体性。

聚合可以作为存在的基本单元,你可以对整个聚合请求加载或保存,事物不应该跨聚合边界外。

DDD聚合是有时和集合类如List等混合,DDD聚合是一个领域概念,而集合是通用的概念。一个聚合可以有多个集合作为字段,通常在不同场景下聚合的不同于DDD聚合。

banq注:不同意最后一句,凝聚 聚合都是同一个意思,表示事物内在的一种连贯性。

一个聚合类似内存中几个数据表+对象的行为,并且使用语言_业务的事务机制替代数据库的锁机制。

2013-12-15 17:33


一个聚合类似内存中几个数据表+对象的行为,并且使用语言_业务的事务机制替代数据库的锁机制。

上面这句话是什么意思?不懂

DDD聚合     

赞助商链接

赞助商链接

返回顶部

移动版 关于本站 使用帮助 联系反馈 最佳分辨率1366x768
OpenSource JIVEJDON Powered by JdonFramework Code © 2002-20 jdon.com