领域模型概念的可视化.ppt_第1页
领域模型概念的可视化.ppt_第2页
领域模型概念的可视化.ppt_第3页
领域模型概念的可视化.ppt_第4页
领域模型概念的可视化.ppt_第5页
已阅读5页,还剩123页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

领域模型概念的可视化,徐迎晓 复旦大学软件学院,outline,什么是领域模型 概念类 识别和提取概念类 创建领域模型步骤 几个问题 命名 概念类or属性? 属性与外键 数量和单位 添加Specification/ description 相似概念问题 Modeling the Unreal World 不同视角的模型 Process,什么是领域模型 概念类 识别和提取概念类 创建领域模型步骤 几个问题 命名 概念类or属性? 属性与外键 数量和单位 添加Specification/ description 相似概念问题 Modeling the Unreal World 不同视角的模型 Process,Use cases: important requirements analysis artifact, but are not object-oriented. emphasize a process view of the domain. Domain model The most important artifact to create in OOA,领域模型domain model是概念类或 问题领域中实际对象的可视化表达,又称为: 概念模型conceptual models 领域对象模型domain object models 分析对象模型analysis object models.,什么是领域模型 概念类 识别和提取概念类 创建领域模型步骤 几个问题 命名 概念类or属性? 属性与外键 数量和单位 添加Specification/ description 相似概念问题 Modeling the Unreal World 不同视角的模型 Process,概念模型,领域模型显示问题领域中对建模者有意义的概念类 OOA中创建的最重要的制品 识别大量对象或概念类heart of OOA 领域模型表达的是现实世界中的概念类,而不是软件构件(不是软件类或带有职责的软件对象) 识别概念类是问题域调查的一部分 UML中的类图可以显示领域模型,使用UML表示法,领域模型用一组不带操作的类图来表示,可显示: 领域对象或概念类 概念类之间的关联 概念类的属性,可视化字典,领域模型将领域中的单词、概念类可视化,并将其相互关联(比文字更容易阅读) 领域模型显示了视图或抽象的一部分,而将建模者不感兴趣的细节忽略。 创建领域模型同时有助于澄清领域中术语和词汇可视化字典,不是软件设计,领域模型是现实世界问题领域中事物的可视化,而不是软件构件的可视化 不是软件制品如window, database 不带有职责和方法,领域模型显示现实世界的概念,领域模型避免软件制品或类,什么是领域模型 概念类 识别和提取概念类 创建领域模型步骤 几个问题 命名 概念类or属性? 属性与外键 数量和单位 添加Specification/ description 相似概念问题 Modeling the Unreal World 不同视角的模型 Process,创建领域模型步骤,列出候选概念类 在领域模型中画出候选概念类 添加关系 添加属性,什么是领域模型 概念类 识别和提取概念类 创建领域模型步骤 几个问题 命名 概念类or属性? 属性与外键 数量和单位 添加Specification/ description 相似概念问题 Modeling the Unreal World 不同视角的模型 Process,领域模型识别和提取概念类,用概念类种类列表 识别名词短语 使用分析模式,使用概念种类列表,store and airline reservation domains.,饥饿,恐高症,识别名词和名词短语,it is another source of inspiration. Care: a mechanical noun-to-class mapping isnt possible words in natural languages are ambiguous it is recommended in combination with the Conceptual Class Category List technique.,Some are candidate conceptual classes Some maybe ignored in this iteration (“Accounting“ and “commissions“) Some may be attributes of conceptual classes.(Price),使用分析模式,由专家创建并公开的部分领域模型 Martin Fowler 分析模式:可复用的对象模型 Analysis Patterns Reusable Object Models Addison Wesley/Pearson 机械工业出版社 中国电力出版社(影印版),Martin Fowler的主要精品著作有 重构改善既有代码的设计(Refactoring: Improving the Design of Existing Code)、 UML精粹:标准对象建模语言简明指南(UML Distilled:A Brief Guide to the Standard Object Modeling) 分析模式:可重用的对象模型(Analysis Patterns:Reusable Object Models) 规划极限编程(Planning Extreme Programming) 企业应用架构模式(Patterns of Enterprise Application Architecture)等,销售领域候选概念类,POS系统领域模型,Group size,You should preferably be 5-7 persons in the group that identifies concepts. With a group of this size you get several perspectives and ways of thinking. And if the group is larger it can be difficult to agree on the concepts. The group should contain a mixture of persons, e. g. analysts, designers, programmers. There should be at least one domain expert in the group One person is the leader. His/her job is the make the group work dynamically. One should have clear objectives for each meeting! Disputes should be solved harmonically, so it is important that the leader is trusted by everyone.,A process for identifying concepts,1. each person is assigned to search for concepts in different places. 2. the whole group meets and finds concept candidates using brainstorming. All possible concepts should be includes! All concepts are equally important!,3. When no more concepts are found, you have a good starting point for identifying the suitable concepts for the problem area. Divide the concepts into three groups: 1. Concepts which everybody thinks are important 2. Concepts that fall outside the problem area, are more suitable as attributes, concepts with the same meaning etc. 3. Concepts which fall in between these groups. 4. Discuss the concepts in group 3 which not everyone agrees on. These concepts should be treated consistently.,Principles for brainstorming,All ideas are equally important Think quickly, not too much consideration; think more later Let everyone speak (Round-Robin Technique) A good mood can be an important strength,Good concepts,It is important to point out that you probably havent found all appropriate concepts after looking for them the first time, if the problem area isnt very trivial! The more you work with the domain model,the better it gets. It can take several iterations to reach a stable model.,领域模型添加关联,从前有座山,山上有座庙,庙里有个,添加关联,从常用关联列表中导出的关联-由此开始,高优先级关联, A is a physical or logical part of B. A is physically or logically contained in/on B. A is recorded in B.,关联指南,集中于需要保存一定时间的关系(Need to know关联) 提取概念类比识别关联更重要,主要时间应放在识别概念类 太多的关联会使领域模型更混乱 耗时,而效果递减 避免显示冗余或可导出的关联,角色,Each end of an association is called a role. Roles may optionally have: name ftp 2 multiplicity expression Navigability(导航),Multiplicity,The multiplicity value communicates(表明) how many instances can be validly associated with another, at a particular moment, rather than over a span of time. 一夫一妻制 旧车任一时刻只能被一个经销商进货,但一段时间内可能反复被进货,The multiplicity value is dependent on our interest as a modeler and software developer 现实中,Item可以不存储在任何Store中(如已卖出),但软件中,Item总与一个Store相联系,Naming Associations,TypeName-VerbPhrase-TypeName format verb phrase creates a sequence that is readable and meaningful in the model context. start with a capital letter association represents a classifier of links between instances; in the UML 两种常用格式 Paid-by PaidBy,default direction to read an association name is left to right or top to bottom not a UML default, but a common convention.,Multiple Associations Between Two Types,Domain Modeling期间,association只是对现实世界的分析,不意味着需要实现 实现关联最常用的方法:使用属性,Unforgettable Relationships in the Store,Applying the Category of Associations Checklist,添加关联,识别名词和名词短语,领域模型添加属性,属性,Attribute of Sale,a receipt (which reports the information of a sale) normally includes a date and time, and management wants to know the dates and times of sales for a variety of reasons. Consequently, the Sale conceptual class needs a date and time attribute.,Multiplicity From SalesLineItem to Item,添加属性,Exercise,Make a class diagram that captures the following: A company consists of departments and employees. A department has responsibility for zero, one or more projects. A company has: name, address and telephone. A department has name. A project has name. An employee has name, address, a social security number (SSN) and is participating in zero, one or more projects. Let the class diagram show: classes with attributes, relations (with role names) between the classes and multiplicity for the relations.,A bank has customers with different status. The bank offers different services depending on the status of a customer. A customer can have several accounts and several loans. For each customer the system must know his/her income for the last 12 months. Each customer has a collection of other customers which serve as his/her associates. An associate can be warrantor ( 担保人) for a loan and can also upgrade the status of a customer. Each loan in the bank is associated with the house that it is used for. A house loan may need a warrantor. A customer may also use another house already in his/her possession as a security抵押品 for a loan. In that case, information about the address, taxvalue etc. for the security house is needed. The customer must also always specify the same information for the house which the loan concerns. Only customers of the bank may have a loan. Customers with payment complaints during the last three years cannot get loans.,什么是领域模型 概念类 识别和提取概念类 创建领域模型步骤 几个问题 命名 概念类or属性? 属性与外键 数量和单位 添加Specification/ description 相似概念问题 Modeling the Unreal World 不同视角的模型 Process,agile modeling approach,the purpose of creating a domain model is to quickly understand and communicate a rough approximation of the key concepts. agile models are usually discarded shortly after creation,Sketching a Class Diagram Tool?,命名,mapmaker strategy also named the Use the Domain Vocabulary strategy,用关联 or 属性?,属性简单数据类型 关联复杂数据类型,属性某种数据类型,只关心值,不必要区分不同实体 Primitive data type number, string, boolean, date, or time non-primitive data type(also known as value objects, a non-primitive class, Data Type Classes) 概念类需要区分不同实体,概念类or属性,常见错误: 将应该作为概念类的当做属性 -规则:若在现实世界中我们不把X当作数字或文本,则X可能是概念类而不是属性,If in doubt, make it a separate concept. Attributes should be fairly rare in a domain model.,属性与外键,undesirable because its purpose is to relate the Cashier to a Register object.,Better relate types with an association, not with an attribute. There are many ways to relate objectsforeign keys being one defer how to implement the relation until design to avoid design creep(creep, not anticipated near the start),数量与单位,Most numeric quantities should not be represented as plain numbers. price or velocity 速度 These are quantities with associated units,Solution( In the general case,) represent Quantity as a distinct conceptual class, with an associated Unit,Quantities are considered data types (unique identity of instances is not important) it is acceptable to collapse their illustration into the attribute section of the class box,解决相似概念,A thing that records sales and payments, Register登记簿: a book that logged sales and payments. cash register:收银机 Acquire a generalized meaning over time. POST: point-of-sale terminal. In computerese, a terminal is any end-point device in a system, such as a client PC, a wireless networked PDA, and so forth.,Modeling the Unreal World,some candidate conceptual classes related to a telecom-munication switch: Message, Connection, Port, Dialog, Route, Protocol.,添加Specification/ description,the need for specification conceptual classes is common in many domain models.,规则:使用Specification/ description的场合 当需要对Item或服务进行描述(独立于这些条目或服务当前存在的任何具体例子)时 删除实例会导致有用信息丢失时(这些信息和被删除的东西不恰当地关联在一起了) 要减少信息冗余,common in sales , product, and manufacturing Domains,a ProductSpecification (or ItemSpecification, ProductDescription .) conceptual class records information about items does not represent an Item, it represents a description of information about items it is common to state that an XSpecification Describes an X,又一例(服务),电信套餐 PackageDescription rates per minute wireless Internet content cost 实际卖出去的套餐 gold package sold to XXX on Jan. 1, 2047 at $55 per month,又一例(服务),航班失事,则取消所有航班(service),所有Flight对象删除。则各个number的航班目的地信息全部丢失,应该把number部分提取出来,同一种图可用于不同视角的模型,Essential or conceptual perspective 现实世界 Specification perspective 独立于语言的软件世界 Implementation perspective 具体语言实现,解决语义鸿沟-用相同的名称 representational gap or semantic gap,Class general term representing either a real-world thing (a conceptual class) or software thing (a software class).,Conceptual class real-world concept or thing A conceptual or essential perspective The UP Domain Model contains conceptual classes.,Software class a class representing a specification or implementation perspective of a software component, regardless of the process or method. Des

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论