- 浏览: 40586 次
- 性别:
文章分类
最新评论
-
sunheavenvan:
我觉得不存在提炼出有所谓的本质,提炼的目的是获取较为准确的心智 ...
Jdon007四象图坐标表示 -
yangyi:
好像没有提及Seam给测试和OO设计上带来的便宜,不好意思,还 ...
Seam生命周期 -
buptwhisper:
性能一直是个问题
Seam生命周期 -
sulong:
oojdon 写道如果大家站在Gavin King的角度,包括 ...
Seam生命周期 -
may_cauc:
扬长避短吧,任何一种技术的出现都有其初衷。不要轻易否定,在否定 ...
Seam生命周期
这是DDD的原文,我认为最好的结论就是最后加粗部分,让模型和数据分开,而不是折中处理,这也是CQRS的本质。Designing Objects for Relational DatabasesThe most common nonobject component of primarily object-oriented software systems is the relational database. This reality presents the usual problems of a mixture of paradigms (see Chapter 5). But the database is more intimately related to the object model than are most other components. The database is not just interacting with the objects; it is storing the persistent form of the data that makes up the objects themselves. A good deal has been written about the technical challenges of mapping objects to relational tables and effectively storing and retrieving them. A recent discussion can be found in Fowler 2002. There are reasonably refined tools for creating and managing mappings between the two. Apart from the technical concerns, this mismatch can have a significant impact on the object model. There are three common cases:
When the database schema is being created specifically as a store for the objects, it is worth accepting some model limitations in order to keep the mapping very simple. Without other demands on schema design, the database can be structured to make aggregate integrity safer and more efficient as updates are made. Technically, the relational table design does not have to reflect the domain model. Mapping tools are sophisticated enough to bridge significant differences. The trouble is, multiple overlapping models are just too complicated. Many of the same arguments presented for MODEL-DRIVEN DESIGN—avoiding separate analysis and design models—apply to this mismatch. This does entail some sacrifice in the richness of the object model, and sometimes compromises have to be made in the database design (such as selective denormalization), but to do otherwise is to risk losing the tight coupling of model and implementation. This approach doesn't require a simplistic one-object/one-table mapping. Depending on the power of the mapping tool, some aggregation or composition of objects may be possible. But it is crucial that the mappings be transparent, easily understandable by inspecting the code or reading entries in the mapping tool.
On the other hand, there are many cases in which the data comes from a legacy or external system that was never intended as a store of objects. In this situation, there are, in reality, two domain models coexisting in the same system. Chapter 14, "Maintaining Model Integrity," deals with this issue in depth. It may make sense to conform to the model implicit in the other system, or it may be better to make the model completely distinct. Another reason for exceptions is performance. Quirky design changes may have to be introduced to solve execution speed problems.
But for the important common case of a relational database acting as the persistent form of an object-oriented domain, simple directness is best. A table row should contain an object, perhaps along with subsidiaries in an AGGREGATE. A foreign key in the table should translate to a reference to another ENTITY object. The necessity of sometimes deviating from this simple directness should not lead to total abandonment of the principle of simple mappings.
The UBIQUITOUS LANGUAGE can help tie the object and relational components together to a single model. The names and associations of elements in the objects should correspond meticulously to those of the relational tables. Although the power of some mapping tools may make this seem unnecessary, subtle differences in relationships will cause a lot of confusion.
The tradition of refactoring that has increasingly taken hold in the object world has not really affected relational database design much. What's more, serious data migration issues discourage frequent change. This may create a drag on the refactoring of the object model, but if the object model and the database model start to diverge, transparency can be lost quickly.
Finally, there are some reasons to go with a schema that is quite distinct from the object model, even when the database is being created specifically for your system. The database may also be used by other software that will not instantiate objects. The database may require little change, even while the behavior of the objects changes or evolves rapidly. Cutting the two loose from each other is a seductive path. It is often taken unintentionally, when the team fails to keep the database current with the model. If the separation is chosen consciously, it can result in a clean database schema—not an awkward one full of compromises conforming to last year's object model. |
发表评论
-
论继承
2011-09-05 17:37 218继承是现实系统中非常 ... -
Jdon007四象图坐标表示
2011-09-03 11:42 1625http://www.jdon.com/jivejdon/th ... -
面向对象掠影
2011-07-16 22:25 827转自链接:http://www.cnblo ... -
specification 规格模式
2011-02-14 22:57 115MF 和 Evans 发明的模式 -
A comparison of DCI and SOA, in Java_003
2011-02-14 12:43 62DCI和SOA的对照 -
DCI architecture - The Common Sense of Object Orientated Programming
2011-02-14 12:38 77In regular OO, I work with cla ... -
MVC To DCI
2011-02-14 12:29 204MVC to DCI -
DCI in Real World
2011-02-14 12:22 826逃出面向类编程的魔爪,重新思考对象 This is a ... -
DCI之转账简单Example
2011-02-14 11:33 194http://stackoverflow.com/questi ... -
The DCI Architecture
2011-02-14 01:05 1157The DCI Architecture: A ... -
DDD 概念
2011-02-11 15:22 775来自一个PPT的截图 ... -
UML元素
2011-02-11 14:52 659UML 统一建模语言,它是表达我们OO建模的图形工具,UML图 ... -
Rethinking architecture with CQRS
2011-02-10 22:57 911这是axonframework的作者Allard Buijze ... -
DCI and Services (EJB)
2011-02-10 22:38 771http://blog.maxant.co.uk/peb ... -
来自Jdon的DDD总结
2011-02-10 22:31 928http://www.jdon.com/jivejdon/th ... -
DDD设计,为什么我热爱CQRS
2011-02-10 22:25 1491地址是:http://jonathan-oliver.bl ... -
设计模式的脉络
2011-02-10 14:13 721设计模式一般是指GOF那本书引出来的名词,其应该是代码模式,而 ... -
对象设计原则
2011-02-08 00:36 711现在我们面对的是让人 ...
相关推荐
Oracle8是Oracle首次引入面向对象技术的版本,它提供了一种结合面向对象和关系表达的解决方案,使得数据库设计更加紧凑有效。 Oracle数据库在全球范围内广泛应用,尤其在大型企业、Web站点和UNIX平台中占据重要地位...
面向对象设计与关系数据库设计之间的差异,源于两者理论基础的不同。面向对象设计强调耦合、聚合、封装等概念,关注数据和行为的封装;而关系数据库设计基于数学理论,专注于数据的存储和检索。这一差异导致在实际...
关系数据库设计是构建高效、稳定和可扩展的信息系统的关键步骤。它涉及到对业务需求的深入理解,以及如何将这些需求转化为合理的数据结构。以下是对数据库设计的一些重要考虑因素: 1. **需求分析**:在设计数据库...
面向对象数据库系统(OODBS)和关系数据库系统(RDBMS)是两种主要的数据库管理系统,它们在设计理念和数据表示上存在显著差异。OODBS结合了数据库管理和面向对象编程的特性,使得数据和程序设计更加紧密集成。面向对象...
在UML建模的各个阶段,从概念模型到逻辑模型再到物理模型的构建,均能为关系数据库设计提供关键的信息。在业务建模阶段,通过分析业务用例和业务对象模型,可以初步构建数据库的概念模型,其中包含了核心的数据实体...
### 数据库设计与业务实体对象到数据库表的映射关系 #### 一、数据库设计概述 数据库设计是在软件工程和信息系统领域中一个重要的环节,它涉及到如何有效地组织数据以满足特定业务需求。良好的数据库设计不仅能...
4. **实现关系**:对象模型中的关系在关系数据库中可能表现为连接表或嵌入数据。例如,一个`Student`类可能与`Class`类有一对多的关联,这可以通过在`Class`表中添加`StudentID`的外键字段来实现。 这些映射策略的...
数据库设计文档.pdf 本文档是人资信息管理系统数据库设计文档,主要对软件后台数据库的概念模型设计和物理模型设计作出了统一的规定,同时确定了每个表的数据字典构造。该文档是开发人员、测试人员编码及测试的重要...
在传统的关系数据库中,数据被表示为表格,其中每一行代表一个元组,每一列代表一个属性,而这些属性通常都是原子性的,即不可再分的值。然而,在对象关系数据库中,这种限制被放宽,允许数据模型包含更复杂的结构。...
针对面向对象技术和关系数据库的特点,将两者相结合,建立了对象关系数据库管理系统,既支持已经被广泛使用的SQL,不仅...文中还提出了对象关系数据库的设计方法和对象映射成关系数据库的方式,其方式简便,实用性强。
8. **设计原则**:在首次设计对象数据库时,我们需要考虑数据的组织方式、对象之间的关系、查询效率、扩展性等因素。合理的对象设计能够提高系统的可维护性和性能。 9. **迁移与集成**:如果从关系型数据库迁移到...
### 基于对象关系数据库的移动对象数据库管理系统的研究 #### 概述 本文探讨了一种新型的移动对象数据库管理系统(Moving Objects Database Management System, MOBDBMS),该系统基于对象关系数据库(Object-...
总结起来,本章内容深入探讨了如何使用UML进行面向对象分析与设计,同时考虑了数据库设计的特殊需求,为开发者提供了在实际项目中融合这两种方法的实用指导。通过理解和应用这些原则,开发者可以更有效地创建出既能...
采用面向对象的统一建模方法,如UML和Rational Rose,可以将软件分析设计与数据库设计紧密结合,提高开发效率,减少两者间的脱节。这种方法提供了一个全面而系统化的途径,对于现代软件工程来说具有显著的优势。
10. 在关系数据库设计中,关系模式的设计是数据库设计中规律设计阶段的任务。 11. 在关系数据库中,关系代数运算是以代数运算为根底的运算,例如 Select 语句、Where 语句、Group by 语句等。 12. 在关系数据库中...
数据库可以分为多种类型,包括关系数据库、对象数据库、文档数据库等。 在 OA 协同办公系统中,使用的是关系数据库管理系统(RDBMS),它能够提供高效的数据存储和管理服务。关系数据库管理系统使用表(Table)来...
最后,数据库设计文档应详细记录每个表的字段说明、数据类型、约束条件、索引设计、触发器、存储过程等数据库对象的创建细节。这些内容都是数据库设计的关键组成部分,关系到数据库的整体性能、安全性和易用性。设计...
关系数据库设计是软件项目中至关重要的一步,它构成了软件数据管理的基础。数据库设计的重要性往往被低估,但实际上,它对项目的成功起着决定性作用。在实际工作中,开发人员通常是数据库设计的主要参与者,尽管DBA...