系统分析与设计 hw5

领域建模

  • 阅读 Asg_RH 文档,按用例构建领域模型

    系统分析与设计 hw5_第1张图片
    task2
  • 数据库建模(E-R 模型)

    系统分析与设计 hw5_第2张图片
    physicalmodel

    导出的 MySQL 脚本:

    drop table if exists Hotel;
    
    drop table if exists "Order";
    
    drop table if exists Room;
    
    drop table if exists User;
    
    /*==============================================================*/
    /* Table: Hotel                                                 */
    /*==============================================================*/
    create table Hotel
    (
       hotelID              integer not null,
       roomID               Integer,
       city                 char not null,
       name                 char not null,
       primary key (hotelID)
    );
    
    /*==============================================================*/
    /* Table: "Order"                                               */
    /*==============================================================*/
    create table "Order"
    (
       indateTime           datetime not null,
       outdateTime          datetime not null,
       hotelID              integer not null,
       roomType             char not null,
       orderID              integer not null,
       userID               char(20),
       primary key (orderID)
    );
    
    /*==============================================================*/
    /* Table: Room                                                  */
    /*==============================================================*/
    create table Room
    (
       roomID               Integer not null,
       type                 varchar(20) not null,
       price                integer not null,
       hotelID              integer not null,
       primary key (roomID)
    );
    
    /*==============================================================*/
    /* Table: User                                                  */
    /*==============================================================*/
    create table User
    (
       userID               char(20) not null,
       orderID              integer,
       name                 char(20) not null,
       phone                integer(11) not null,
       email                char(30) not null,
       primary key (userID)
    );
    
    alter table Hotel add constraint FK_Reference_2 foreign key (roomID)
          references Room (roomID) on delete restrict on update restrict;
    
    alter table "Order" add constraint FK_Reference_1 foreign key (hotelID)
          references Hotel (hotelID) on delete restrict on update restrict;
    
    alter table "Order" add constraint FK_Reference_4 foreign key ()
          references User (userID) on delete restrict on update restrict;
    
    alter table "Order" add constraint FK_Reference_5 foreign key ()
          references User (userID) on delete restrict on update restrict;
    
    alter table "Order" add constraint FK_Reference_6 foreign key (userID)
          references User (userID) on delete restrict on update restrict;
    
    alter table User add constraint FK_Reference_3 foreign key (orderID)
          references "Order" (orderID) on delete restrict on update restrict;
    
    
  • 数据库逻辑模型 与 领域模型 的异同

  1. 相同:都是用来抽象出主要的类,描述不同类之间的关系,从而辅助分析与设计

  2. 不同处:领域模型是对用户业务的领域描述的高度抽象,可以帮助需求分析人员快速熟悉目标领域的词汇和操作,从而更好的理解业务需求;不涉及到具体的实现。但数据库逻辑模型涉及到数据库的具体实现,对象是实体和关系(ER),描述了具体的实现方法。

    用户只需要关心领域模型,开发人员通过领域模型的描述,构建数据库逻辑模型。

你可能感兴趣的:(系统分析与设计 hw5)