锁定老帖子 主题:问一个系统设计的问题
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2007-12-23
千万不要首先就考虑数据怎么存储
理清业务,搞清域,再适当考虑怎样存储就可以了 说白了就是首先要逻辑上没有问题再来实际的 如果需求都未搞清楚,来谈对需求的持久化那不是白搭 反过来如果业务模型搞清楚了,逻辑上无问题了,那存储实际上基本上已经定好了,剩下的就是存储细节和性能了 至于先后顺序楼上有人说得蛮好的,看习惯了,无论哪种方式,都会需要微调的 无论怎么样我们都需要搞清业务模型才能够去设计数据库,千万别从数据库入手来设计业务了,我目前所在的系统在扩展性和响应需求的时候就遇到了当初数据库设计的瓶颈了,现在数据到处都有,一片混乱,明年可能会全面整合业务了 |
|
返回顶楼 | |
发表时间:2007-12-25
谢谢大家的讨论,最近偶然看到一本外文书,大致和楼上的表达的思想很接近,作者是参与Hibernate设计的开发人员,书中也对这设计的方式进行了讨论,作者就认为没有一成不变的设计方式,要根据具体的情况来做具体的设计方式,归纳为三种
1.POJO-Driven Approach In the POJO-driven approach you start with an object/domain model, and using JSR-220 annotation or Javadoc metadata comments, you define how each field in a class maps to a database column. At runtime, Hibernate uses the annotations to dynamically create the mappings. 这种方法适用于数据模型还没创建和设计或者不明确的新应用程序 2.Data Model–Driven Approach In the model-driven approach you start with a database schema for the chosen database system, and using a tool like Middlegen or Hibernate Synchronizer, you generate mappings and POJOs for each table being mapped. This approach provides a fast start-up time for development。 这种适合已建立明确的数据库或者数据模型的web开发,并能快速的开发。 但也指出使用这种设计的方式会造成域模型的semantic(语义)不够丰富,达不到你原先设想的那样。 3. 作者自己推荐的是一种是第三种方式,称为HBM-Driven Approach。 The two previous approaches, taking either a domain-model or data-model approach, typically result in HBM mappings that are not quite complete. Every time I use either of the approaches above in a moderately complex application, I find myself fine-tuning the HBM files to either get more accurate POJOs (in the data-driven approach) or more efficient, manageable database schema (in the POJO-driven approach). The third approach suggested here takes the stand that object-relational mapping is an inescapable, necessary evil that should be taken into consideration early and in a head-first fashion in the development of your application.By creating detailed, accurate HBM files you will end up with both a domain model and a database schema that meets your application needs and ensures the longevity of the data |
|
返回顶楼 | |
发表时间:2007-12-26
从我做的实际项目(项目数>10)开发来看,从来没有一个项目的数据库是完美的,总是在修修补补,据我的了解,其他的项目也大抵如此,那么使用Hibernate开发的话应当如何设计?
|
|
返回顶楼 | |
发表时间:2007-12-26
自从有了rake之后
改数据库逻辑已经不是难事了 不用求DBA了, 所以不从数据库开始设计是必然的事 |
|
返回顶楼 | |