领域模型概念的可视化53课件.ppt

上传人:小飞机 文档编号:1441847 上传时间:2022-11-25 格式:PPT 页数:128 大小:1.72MB
返回 下载 相关 举报
领域模型概念的可视化53课件.ppt_第1页
第1页 / 共128页
领域模型概念的可视化53课件.ppt_第2页
第2页 / 共128页
领域模型概念的可视化53课件.ppt_第3页
第3页 / 共128页
领域模型概念的可视化53课件.ppt_第4页
第4页 / 共128页
领域模型概念的可视化53课件.ppt_第5页
第5页 / 共128页
点击查看更多>>
资源描述

《领域模型概念的可视化53课件.ppt》由会员分享,可在线阅读,更多相关《领域模型概念的可视化53课件.ppt(128页珍藏版)》请在三一办公上搜索。

1、领域模型概念的可视化,徐迎晓xuyingxiao126复旦大学软件学院,领域模型概念的可视化徐迎晓,outline,什么是领域模型概念类识别和提取概念类创建领域模型步骤几个问题命名概念类or属性?属性与外键数量和单位添加Specification/ description相似概念问题Modeling the Unreal World不同视角的模型Process,outline什么是领域模型,领域模型概念的可视化53课件,领域模型概念的可视化53课件,领域模型概念的可视化53课件,什么是领域模型概念类识别和提取概念类创建领域模型步骤几个问题命名概念类or属性?属性与外键数量和单位添加Specif

2、ication/ 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 modelThe most important artifact to create in OOA,Use cases:,领域模型domain model是概念类或问题领域中实际对象的可视化表达,又称

3、为:概念模型conceptual models领域对象模型domain object models分析对象模型analysis object models.,领域模型domain model是概念类或问题领域中实际对,什么是领域模型概念类识别和提取概念类创建领域模型步骤几个问题命名概念类or属性?属性与外键数量和单位添加Specification/ description相似概念问题Modeling the Unreal World不同视角的模型Process,什么是领域模型,概念模型,领域模型显示问题领域中对建模者有意义的概念类 OOA中创建的最重要的制品 识别大量对象或概念类heart o

4、f OOA领域模型表达的是现实世界中的概念类,而不是软件构件(不是软件类或带有职责的软件对象)识别概念类是问题域调查的一部分UML中的类图可以显示领域模型,概念模型领域模型显示问题领域中对建模者有意义的概念类,使用UML表示法,领域模型用一组不带操作的类图来表示,可显示:领域对象或概念类概念类之间的关联概念类的属性,使用UML表示法,领域模型用一组不带操作的类图来表示,可显示,可视化字典,领域模型将领域中的单词、概念类可视化,并将其相互关联(比文字更容易阅读)领域模型显示了视图或抽象的一部分,而将建模者不感兴趣的细节忽略。创建领域模型同时有助于澄清领域中术语和词汇可视化字典,可视化字典,领域模

5、型概念的可视化53课件,领域模型概念的可视化53课件,领域模型概念的可视化53课件,领域模型概念的可视化53课件,领域模型概念的可视化53课件,领域模型概念的可视化53课件,不是软件设计,领域模型是现实世界问题领域中事物的可视化,而不是软件构件的可视化不是软件制品如window, database不带有职责和方法,不是软件设计领域模型是现实世界问题领域中事物的可视化,而不是,领域模型显示现实世界的概念,领域模型显示现实世界的概念,领域模型避免软件制品或类,领域模型避免软件制品或类,领域模型概念的可视化53课件,什么是领域模型概念类识别和提取概念类创建领域模型步骤几个问题命名概念类or属性?属性

6、与外键数量和单位添加Specification/ description相似概念问题Modeling the Unreal World不同视角的模型Process,什么是领域模型,创建领域模型步骤,列出候选概念类在领域模型中画出候选概念类添加关系添加属性,创建领域模型步骤列出候选概念类,什么是领域模型概念类识别和提取概念类创建领域模型步骤几个问题命名概念类or属性?属性与外键数量和单位添加Specification/ description相似概念问题Modeling the Unreal World不同视角的模型Process,什么是领域模型,领域模型识别和提取概念类,用概念类种类列表识别名

7、词短语使用分析模式,领域模型识别和提取概念类用概念类种类列表,领域模型概念的可视化53课件,使用概念种类列表,store and airline reservation domains.,饥饿,恐高症,使用概念种类列表store and airline rese,识别名词和名词短语,识别名词和名词短语,领域模型概念的可视化53课件,it is another source of inspiration.Care:a mechanical noun-to-class mapping isnt possiblewords in natural languages are ambiguousit i

8、s recommended in combination with the Conceptual Class Category List technique.,it is another source of inspir,Some are candidate conceptual classesSome maybe ignored in this iteration (Accounting and commissions)Some may be attributes of conceptual classes.(Price),Some are candidate conceptual,使用分析

9、模式,由专家创建并公开的部分领域模型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

10、Object Modeling)分析模式:可重用的对象模型(Analysis Patterns:Reusable Object Models) 规划极限编程(Planning Extreme Programming)企业应用架构模式(Patterns of Enterprise Application Architecture)等,Martin Fowler的主要精品著作有,领域模型概念的可视化53课件,销售领域候选概念类,销售领域候选概念类,POS系统领域模型,POS系统领域模型,Group size,You should preferably be 5-7 persons in the g

11、roup 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 doma

12、in expert in the groupOne 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.,Group sizeYou should preferab,A process for identi

13、fyingconcepts,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!,A process for identifyingconc,3. When no more concepts are foun

14、d, 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 important2. Concepts that fall outside the problem area, are more suitable as attributes, concepts with the same meaning etc.3. C

15、oncepts which fall in between these groups.4. Discuss the concepts in group 3 which not everyone agrees on. These concepts should be treated consistently.,3. When no more concepts are f,Principles for brainstorming,All ideas are equally importantThink quickly, not too much consideration; think more

16、laterLet everyone speak (Round-Robin Technique)A good mood can be an important strength,Principles for brainstorming,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 mor

17、e you work with the domain model,the better it gets. It can take several iterations to reach a stable model.,Good conceptsIt is important,领域模型添加关联,领域模型添加关联,领域模型概念的可视化53课件,从前有座山,山上有座庙,庙里有个,从前有座山,山上有座庙,庙里有个,添加关联,从常用关联列表中导出的关联-由此开始,添加关联从常用关联列表中导出的关联-由此开始,领域模型概念的可视化53课件,领域模型概念的可视化53课件,领域模型概念的可视化53课件,领域模

18、型概念的可视化53课件,高优先级关联, A is a physical or logical part of B. A is physically or logically contained in/on B. A is recorded in B.,高优先级关联 A is a physical or log,关联指南,集中于需要保存一定时间的关系(Need to know关联)提取概念类比识别关联更重要,主要时间应放在识别概念类太多的关联会使领域模型更混乱耗时,而效果递减避免显示冗余或可导出的关联,关联指南集中于需要保存一定时间的关系(Need to kno,角色,Each end of a

19、n association is called a role.Roles may optionally have:name ftp 202.120.127.92multiplicity expressionNavigability(导航),角色Each end of an association i,Multiplicity,Multiplicity,The multiplicity value communicates(表明) how many instances can be validly associated with another, at a particular moment,

20、rather than over a span of time.一夫一妻制旧车任一时刻只能被一个经销商进货,但一段时间内可能反复被进货,The multiplicity value communi,The multiplicity value is dependent on our interest as a modeler and software developer现实中,Item可以不存储在任何Store中(如已卖出),但软件中,Item总与一个Store相联系,The multiplicity value is depe,Naming Associations,TypeName-Ver

21、bPhrase-TypeName formatverb phrase creates a sequence that is readable and meaningful in the model context.start with a capital letterassociation represents a classifier of links between instances; in the UML两种常用格式Paid-byPaidBy,Naming AssociationsTypeName-V,default direction to read an association n

22、ame is left to right or top to bottomnot a UML default, but a common convention.,default direction to read an a,Multiple Associations Between Two Types,Multiple Associations Between,Domain Modeling期间,association只是对现实世界的分析,不意味着需要实现实现关联最常用的方法:使用属性,Domain Modeling期间,association只,Unforgettable Relations

23、hips in the Store,Unforgettable Relationships in,Applying the Category of Associations Checklist,Applying the Category of Assoc,领域模型概念的可视化53课件,领域模型概念的可视化53课件,添加关联,添加关联,领域模型概念的可视化53课件,识别名词和名词短语,识别名词和名词短语,领域模型概念的可视化53课件,领域模型添加属性,领域模型添加属性,领域模型概念的可视化53课件,属性,属性,Attribute of Sale,a receipt (which reports

24、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.,Attribute of Salea receipt (wh,领域模型概念的可视化53课件,Multiplicity From SalesLineItem to

25、Item,Multiplicity From SalesLineIte,领域模型概念的可视化53课件,领域模型概念的可视化53课件,添加属性,添加属性,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 departm

26、ent 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.,ExerciseMake a c

27、lass diagram t,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

28、 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

29、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

30、 payment complaints during the last three years cannot get loans.,A bank has customers with diff,领域模型概念的可视化53课件,领域模型概念的可视化53课件,领域模型概念的可视化53课件,领域模型概念的可视化53课件,领域模型概念的可视化53课件,领域模型概念的可视化53课件,什么是领域模型概念类识别和提取概念类创建领域模型步骤几个问题命名概念类or属性?属性与外键数量和单位添加Specification/ description相似概念问题Modeling the Unreal World不同视角

31、的模型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,agile modeling approach, the p,Sketching a Class Diagram Tool?,Sketching a C

32、lass Diagram,命名,mapmaker strategyalso named the Use the Domain Vocabulary strategy,命名mapmaker strategy,用关联 or 属性?,用关联 or 属性?,属性简单数据类型关联复杂数据类型,属性简单数据类型,属性某种数据类型,只关心值,不必要区分不同实体Primitive data typenumber, string, boolean, date, or time non-primitive data type(also known as value objects, a non-primitive

33、 class, Data Type Classes)概念类需要区分不同实体,属性某种数据类型,只关心值,不必要区分不同实体,概念类or属性,常见错误: 将应该作为概念类的当做属性-规则:若在现实世界中我们不把X当作数字或文本,则X可能是概念类而不是属性,概念类or属性常见错误: 将应该作为概念类的当做属性,If in doubt, make it a separate concept. Attributes should be fairly rare in a domain model.,领域模型概念的可视化53课件,属性与外键,属性与外键,undesirable because its pu

34、rpose is to relate the Cashier to a Register object.,undesirable,Betterrelate types with an association, not with an attribute.There are many ways to relate objectsforeign keys being onedefer how to implement the relation until designto avoid design creep(creep, not anticipated near the start),Bette

35、r,数量与单位,数量与单位,Most numeric quantities should not be represented as plain numbers.price or velocity 速度These are quantities with associated units,Most numeric quantities should,Solution( In the general case,)represent Quantity as a distinct conceptual class, with an associated Unit,Solution( In the ge

36、neral case,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,Quantities are considered data,解决相似概念,A thing that records sales and payments,Register登记簿:a book that logged sale

37、s 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.,解决相似概念A thing that records sal,领域模型概念的可视化53课件,Modeling the Unreal World,s

38、ome candidate conceptual classes related to a telecom-munication switch: Message, Connection, Port, Dialog, Route, Protocol.,Modeling the Unreal Worldsome,添加Specification/ description,the need for specification conceptual classes is common in many domain models.,添加Specification/ descriptionth,领域模型概念

39、的可视化53课件,规则:使用Specification/ description的场合当需要对Item或服务进行描述(独立于这些条目或服务当前存在的任何具体例子)时删除实例会导致有用信息丢失时(这些信息和被删除的东西不恰当地关联在一起了)要减少信息冗余,规则:使用Specification/ descriptio,common in sales , product, and manufacturing Domains,a ProductSpecification (or ItemSpecification, ProductDescription .) conceptual class reco

40、rds information about itemsdoes not represent an Item, it represents a description of information about itemsit is common to state that an XSpecification Describes an X,common in sales , product, and,又一例(服务),电信套餐PackageDescription rates per minute wireless Internet content cost实际卖出去的套餐gold package s

41、old to XXX on Jan. 1, 2047 at $55 per month,又一例(服务)电信套餐,又一例(服务),航班失事,则取消所有航班(service),所有Flight对象删除。则各个number的航班目的地信息全部丢失,应该把number部分提取出来,又一例(服务)航班失事,则取消所有航班(service),所,领域模型概念的可视化53课件,同一种图可用于不同视角的模型,Essential or conceptual perspective现实世界Specification perspective独立于语言的软件世界Implementation perspective具体

42、语言实现,同一种图可用于不同视角的模型Essential or con,领域模型概念的可视化53课件,解决语义鸿沟-用相同的名称representational gap or semantic gap,解决语义鸿沟-用相同的名称,Classgeneral term representing either a real-world thing (a conceptual class) or software thing (a software class).,Class,Conceptual classreal-world concept or thingA conceptual or esse

43、ntial perspectiveThe UP Domain Model contains conceptual classes.,Conceptual class,Software classa class representing a specification or implementation perspective of a software component, regardless of the process or method. Design classa member of the UP Design Modela synonym for software classeit

44、her a specification or implementation perspective, as desired by the modeler.,Software class,Implementation classa class implemented in an object-oriented language such as Java.,Implementation class,Report ObjectsInclude Receipt in the Model?,No-In general, showing a report of other information in a

45、 domain model is not useful since all its information is derived from other sources;Yes-A receipt has a special role in terms of the business rules.赋予持有者退货的权利(return bought items)本次迭代未考虑退货,因而不包括Receipt,处理Handle Returns的迭代中再考虑,Report ObjectsInclude Receipt,领域模型和UP,初始-no细化-主要在此创建,当需要理解值得注意的概念,并映射到部分设计

46、工作的类中熟练者每次迭代只需几小时来开发领域模型,若是用预定义的分析模式,还将更快,领域模型和UP初始-no,The UP Business Object Model vs. Domain Model,Business Object ModelThe UP BOM serves as an abstraction of how business workers and business entities need to be related and how they need to collaborate in order to perform the business. RUP用几种不同的图

47、表示 (class, activity, and sequence)显示整个企业如何运作若做整个企业的business process engineering最有用,The UP Business Object Model v,Domain ModelBOM的一个子集,更常创建You can choose to develop an incomplete business object model, focusing on explaining things and products important to a domain. . This is often referred to as a domain model. RUP,Domain Model,gPdLaI6F3C0y)v&s#pXmUiRfNcK9H5,

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 生活休闲 > 在线阅读


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号