领域建模-lesson7

2024-01-30 20:10
文章标签 领域建模 lesson7

本文主要是介绍领域建模-lesson7,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

  • a. 阅读 Asg_RH 文档,按用例构建领域模型。
    • 按 Task2 要求,请使用工具 UMLet,截图格式务必是 png 并控制尺寸
    • 说明:请不要受 PCMEF 层次结构影响。你需要识别实体(E)和 中介实体(M,也称状态实体)
      • 在单页面应用(如 vue)中,E 一般与数据库构建有关, M 一般与 store 模式 有关
      • 在 java web 应用中,E 一般与数据库构建有关, M 一般与 session 有关

  • b. 数据库建模(E-R 模型)
    - 按 Task 3 要求,给出系统的 E-R 模型(数据逻辑模型)
    - 建模工具 PowerDesigner(简称PD) 或开源工具 OpenSystemArchitect
    - 不负责的链接 http://www.cnblogs.com/mcgrady/archive/2013/05/25/3098588.html
    - 导出 Mysql 物理数据库的脚本
    - 简单叙说 数据库逻辑模型 与 领域模型 的异同

 导出Mysql 物理数据库的脚本

/*==============================================================*/
/* DBMS name:      Microsoft SQL Server 2012                    */
/* Created on:     2018/5/1 15:39:05                            */
/*==============================================================*/if exists (select 1from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')where r.fkeyid = object_id('payment') and o.name = 'FK_PAYMENT_PAY_CUSTOMER')
alter table paymentdrop constraint FK_PAYMENT_PAY_CUSTOMER
goif exists (select 1from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')where r.fkeyid = object_id('payment') and o.name = 'FK_PAYMENT_REQUIRE_RESERVAT')
alter table paymentdrop constraint FK_PAYMENT_REQUIRE_RESERVAT
goif exists (select 1from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')where r.fkeyid = object_id('reservation') and o.name = 'FK_RESERVAT_HAS_HOTEL')
alter table reservationdrop constraint FK_RESERVAT_HAS_HOTEL
goif exists (select 1from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')where r.fkeyid = object_id('reservation') and o.name = 'FK_RESERVAT_MAKE_CUSTOMER')
alter table reservationdrop constraint FK_RESERVAT_MAKE_CUSTOMER
goif exists (select 1from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')where r.fkeyid = object_id('reservation') and o.name = 'FK_RESERVAT_REQUIRE2_PAYMENT')
alter table reservationdrop constraint FK_RESERVAT_REQUIRE2_PAYMENT
goif exists (select 1from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')where r.fkeyid = object_id('room') and o.name = 'FK_ROOM_HAS_ROOM_HOTEL')
alter table roomdrop constraint FK_ROOM_HAS_ROOM_HOTEL
goif exists (select 1from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')where r.fkeyid = object_id('stay') and o.name = 'FK_STAY_STAY_CUSTOMER')
alter table staydrop constraint FK_STAY_STAY_CUSTOMER
goif exists (select 1from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')where r.fkeyid = object_id('stay') and o.name = 'FK_STAY_STAY2_HOTEL')
alter table staydrop constraint FK_STAY_STAY2_HOTEL
goif exists (select 1from  sysobjectswhere  id = object_id('customer')and   type = 'U')drop table customer
goif exists (select 1from  sysobjectswhere  id = object_id('hotel')and   type = 'U')drop table hotel
goif exists (select 1from  sysindexeswhere  id    = object_id('payment')and   name  = 'require_FK'and   indid > 0and   indid < 255)drop index payment.require_FK
goif exists (select 1from  sysindexeswhere  id    = object_id('payment')and   name  = 'pay_FK'and   indid > 0and   indid < 255)drop index payment.pay_FK
goif exists (select 1from  sysobjectswhere  id = object_id('payment')and   type = 'U')drop table payment
goif exists (select 1from  sysindexeswhere  id    = object_id('reservation')and   name  = 'has_FK'and   indid > 0and   indid < 255)drop index reservation.has_FK
goif exists (select 1from  sysindexeswhere  id    = object_id('reservation')and   name  = 'require2_FK'and   indid > 0and   indid < 255)drop index reservation.require2_FK
goif exists (select 1from  sysindexeswhere  id    = object_id('reservation')and   name  = 'make_FK'and   indid > 0and   indid < 255)drop index reservation.make_FK
goif exists (select 1from  sysobjectswhere  id = object_id('reservation')and   type = 'U')drop table reservation
goif exists (select 1from  sysindexeswhere  id    = object_id('room')and   name  = 'has_room_FK'and   indid > 0and   indid < 255)drop index room.has_room_FK
goif exists (select 1from  sysobjectswhere  id = object_id('room')and   type = 'U')drop table room
goif exists (select 1from  sysindexeswhere  id    = object_id('stay')and   name  = 'stay2_FK'and   indid > 0and   indid < 255)drop index stay.stay2_FK
goif exists (select 1from  sysindexeswhere  id    = object_id('stay')and   name  = 'stay_FK'and   indid > 0and   indid < 255)drop index stay.stay_FK
goif exists (select 1from  sysobjectswhere  id = object_id('stay')and   type = 'U')drop table stay
go/*==============================================================*/
/* Table: customer                                              */
/*==============================================================*/
create table customer (name                 text                 null,"telephone number"   text                 null,"customer id"        text                 not null,constraint PK_CUSTOMER primary key nonclustered ("customer id")
)
go/*==============================================================*/
/* Table: hotel                                                 */
/*==============================================================*/
create table hotel (name                 text                 null,address              text                 null,"hotel id"           text                 null,Attribute_6          char(10)             not null,constraint PK_HOTEL primary key nonclustered (Attribute_6)
)
go/*==============================================================*/
/* Table: payment                                               */
/*==============================================================*/
create table payment (date                 datetime             null,amount               float                null,payment_id           char(10)             not null,id                   char(10)             null,"customer id"        text                 null,constraint PK_PAYMENT primary key nonclustered (payment_id)
)
go/*==============================================================*/
/* Index: pay_FK                                                */
/*==============================================================*/
create index pay_FK on payment (
"customer id" ASC
)
go/*==============================================================*/
/* Index: require_FK                                            */
/*==============================================================*/
create index require_FK on payment (
id ASC
)
go/*==============================================================*/
/* Table: reservation                                           */
/*==============================================================*/
create table reservation (date                 datetime             null,customerid           text                 null,"room number"        int                  null,id                   char(10)             not null,"customer id"        text                 null,Attribute_6          char(10)             null,payment_id           char(10)             null,constraint PK_RESERVATION primary key nonclustered (id)
)
go/*==============================================================*/
/* Index: make_FK                                               */
/*==============================================================*/
create index make_FK on reservation (
"customer id" ASC
)
go/*==============================================================*/
/* Index: require2_FK                                           */
/*==============================================================*/
create index require2_FK on reservation (
payment_id ASC
)
go/*==============================================================*/
/* Index: has_FK                                                */
/*==============================================================*/
create index has_FK on reservation (
Attribute_6 ASC
)
go/*==============================================================*/
/* Table: room                                                  */
/*==============================================================*/
create table room (type                 text                 null,number               int                  not null,Attribute_6          char(10)             null,price                float                null,constraint PK_ROOM primary key nonclustered (number)
)
go/*==============================================================*/
/* Index: has_room_FK                                           */
/*==============================================================*/
create index has_room_FK on room (
Attribute_6 ASC
)
go/*==============================================================*/
/* Table: stay                                                  */
/*==============================================================*/
create table stay ("customer id"        text                 not null,Attribute_6          char(10)             not null,constraint PK_STAY primary key ("customer id", Attribute_6)
)
go/*==============================================================*/
/* Index: stay_FK                                               */
/*==============================================================*/
create index stay_FK on stay (
"customer id" ASC
)
go/*==============================================================*/
/* Index: stay2_FK                                              */
/*==============================================================*/
create index stay2_FK on stay (
Attribute_6 ASC
)
goalter table paymentadd constraint FK_PAYMENT_PAY_CUSTOMER foreign key ("customer id")references customer ("customer id")
goalter table paymentadd constraint FK_PAYMENT_REQUIRE_RESERVAT foreign key (id)references reservation (id)
goalter table reservationadd constraint FK_RESERVAT_HAS_HOTEL foreign key (Attribute_6)references hotel (Attribute_6)
goalter table reservationadd constraint FK_RESERVAT_MAKE_CUSTOMER foreign key ("customer id")references customer ("customer id")
goalter table reservationadd constraint FK_RESERVAT_REQUIRE2_PAYMENT foreign key (payment_id)references payment (payment_id)
goalter table roomadd constraint FK_ROOM_HAS_ROOM_HOTEL foreign key (Attribute_6)references hotel (Attribute_6)
goalter table stayadd constraint FK_STAY_STAY_CUSTOMER foreign key ("customer id")references customer ("customer id")
goalter table stayadd constraint FK_STAY_STAY2_HOTEL foreign key (Attribute_6)references hotel (Attribute_6)
go

相同:两者都是人们抽象出来用以辅助分析与设计的工具,抽象出主要的类,描述不同类之间的关系。

不同:领域模型是用户业务描述的高度抽象,来源于业务需求的描述,同时又可以帮助用户和需求分析人员更好的理解业务需求。数据库逻辑模型涉及到更多的细节部分,涉及到数据库的具体实现,而领域模型与数据库的具体实现没有很大的联系。

这篇关于领域建模-lesson7的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/661404

相关文章

【领域驱动设计 打通DDD最小闭环】领域建模

本篇BLOG为DDD流程的第二步,在模型的建立阶段,领域专家与技术人员通过领域建模来完成更为细致的模型建立讨论 领域建模的目的 领域建模主要有两个目的: 将知识可视化,准确、深刻地反映领域知识,并且在业务和技术人员之间达成一致指导系统的设计和编码,也就是说,领域模型应该能够比较容易地转化成数据库模式和代码实现 不同于事件风暴仅仅追求“形似”,也就是说业务是怎样运作的,事件风暴就怎样反映,

阿里巴巴领域建模实践

前言 设计是把双刃剑,没有最好的,也没有更好的,而是条条大路到杭州。同时不设计和过度设计都是有问题的,恰到好处的设计才是我们追求的极致。 DDD(Domain-Driven Design,领域驱动设计)只是一个流派,谈不上压倒性优势,更不是完美无缺。 我更想跟大家分享的是我们是否关注设计本身,不管什么流派的设计,有设计就是好的。 从我看到的代码上来讲,阿里集团内部大部分代码都不属于 DD

【lesson7】服务端业务处理模块实现

文章目录 业务处理实现思路业务处理类设计成员变量成员函数RunModuleupLoadlistShowdownLoadgetETagInfo 业务处理实现思路 云备份项目中 ,业务处理模块是针对客户端的业务请求进行处理,并最终给与响应。而整个过程中包含以下要实现的功能: 借助网络通信模块httplib库搭建http服务器与客户端进行网络通信针对收到的请求进行对应的业务处理并

ChatGPT在大气科学领域建模、数据分析、可视化与资源评估中的高效应用及论文写作

深度探讨人工智能在大气科学中的应用,特别是如何结合最新AI模型与Python技术处理和分析气候数据。介绍包括GPT-4等先进AI工具,旨在帮助学员掌握这些工具的功能及应用范围。内容覆盖使用GPT处理数据、生成论文摘要、文献综述、技术方法分析等实战案例,使学员能够将AI技术广泛应用于科研工作。特别关注将GPT与Python结合应用于遥感降水数据处理、ERA5大气再分析数据的统计分析、干旱监测及风能和

关于领域建模时考虑用户需求的出发点的理解

摘自http://www.jdon.com/42751 最近又重温了领域驱动设计的原著,有了一些新的理解。现在我觉得我能更好地理解jdon007之前说的下面这段话了。 “用 户需求”不能等同于“用户”,捕捉“用户心中的模型”也不能等同于“以用户为核心设计领域模型”。 《老子》书中有个观点:有之以为利,无之以为用。在这里,有之利,即建立领域模型;无之用,即包容用户需求。举些例子,一个杯子要装

系统分析与设计-lesson7

a.阅读 Asg_RH 文档,按用例构建领域模型。 按Task2 要求,请使用工具 UMLet,截图格式务必是 png 并控制尺寸说明:请不要受 PCMEF 层次结构影响。你需要识别实体(E)和 中介实体(M,也称状态实体) b.数据库建模(E-R 模型) 按 Task 3 要求,给出系统的 E-R 模型(数据逻辑模型)建模工具 PowerDesigner(简称PD) 或开源工具 OpenSys

不具备领域建模能力都看不懂蚂蚁金服程序员的代码!?

0 前言 最近,由于工作需要,我接触了网商银行的一个项目。项目里对应的业务模型设计,是我工作这三年来见过的所有模型里最复杂的。于是,利用五一这个短暂的假期,我温习了一遍领域建模相关的知识,对于领域模型的设计,有了一些额外的思考。 在领域界有一本书 《Domain-Driven Design》,是Eric编写的,这本书在Goodreads上的评分是4.15分(相当高)。书中有这样的一段话: “

【系统分析与设计】lesson7

领域建模 a. 阅读 Asg_RH 文档,按用例构建领域模型。 - 按 Task2 要求,请使用工具 UMLet,截图格式务必是 png 并控制尺寸 - 说明:请不要受 PCMEF 层次结构影响。你需要识别实体(E)和 中介实体(M,也称状态实体) 在单页面应用(如 vue)中,E 一般与数据库构建有关, M 一般与 store 模式 有关 在 java web 应用中,E 一般与数据库

系统分析与设计lesson7

1、 领域建模 a. 阅读 Asg_RH 文档,按用例构建领域模型。 按 Task2 要求,请使用工具 UMLet,截图格式务必是 png 并控制尺寸说明:请不要受 PCMEF 层次结构影响。你需要识别实体(E)和 中介实体(M,也称状态实体) 在单页面应用(如 vue)中,E 一般与数据库构建有关, M 一般与 store 模式 有关在 java web 应用中,E 一般与数据库构建有关, M

系统分析与设计——lesson7

1、 领域建模 a. 阅读 Asg_RH 文档,按用例构建领域模型。 按 Task2 要求,请使用工具 UMLet,截图格式务必是 png 并控制尺寸说明:请不要受 PCMEF 层次结构影响。你需要识别实体(E)和 中介实体(M,也称状态实体) 在单页面应用(如 vue)中,E 一般与数据库构建有关, M 一般与 store 模式 有关在 java web 应用中,E 一般与数据库构建有关, M