软件工程12领域模型概念的可视化课件

上传人:cn****1 文档编号:571544946 上传时间:2024-08-11 格式:PPT 页数:129 大小:1.72MB
返回 下载 相关 举报
软件工程12领域模型概念的可视化课件_第1页
第1页 / 共129页
软件工程12领域模型概念的可视化课件_第2页
第2页 / 共129页
软件工程12领域模型概念的可视化课件_第3页
第3页 / 共129页
软件工程12领域模型概念的可视化课件_第4页
第4页 / 共129页
软件工程12领域模型概念的可视化课件_第5页
第5页 / 共129页
点击查看更多>>
资源描述

《软件工程12领域模型概念的可视化课件》由会员分享,可在线阅读,更多相关《软件工程12领域模型概念的可视化课件(129页珍藏版)》请在金锄头文库上搜索。

1、领域模型-概念的可视化领域模型概念的可视化Content什么是领域模型概念类识别和提取概念类创建领域模型步骤几个问题l命名l概念类or属性?l相似概念问题lModeling the Unreal World不同视角的模型Process什么是领域模型Use cases:limportant requirements analysis artifact, but are not object-oriented.lemphasize a process view of the domain.Domain modellThe most important artifact to create in O

2、OA概念模型l领域模型显示问题领域中对建模者有意义的概念类l OOA中创建的最重要的制品l 识别大量对象或概念类heart of OOAl领域模型表达的是现实世界中的概念类,而不是软件构件(不是软件类或带有职责的软件对象)l识别概念类是问题域调查的一部分lUML中的类图可以显示领域模型领域模型domain model是概念类或问题领域中实际对象的可视化表达,又称为:l概念模型conceptual modelsl领域对象模型domain object modelsl分析对象模型analysis object models.使用UML表示法,领域模型用一组不带操作的类图来表示,可显示:l领域对象或

3、概念类l概念类之间的关联l概念类的属性部分领域模型可视化字典领域模型将领域中的单词、概念类可视化,并将其相互关联(比文字更容易阅读)领域模型显示了视图或抽象的一部分,而将建模者不感兴趣的细节忽略。创建领域模型同时有助于澄清领域中术语和词汇可视化字典不是软件设计领域模型是现实世界问题领域中事物的可视化,而不是软件构件的可视化l不是软件制品如window, databasel不带有职责和方法领域模型显示现实世界的概念领域模型避免软件制品或类概念类概念类的三层意思l概念类是思想、事物或对象l可以从以下几方面理解概念类:l符号symboll代表概念的单词或图像l内涵intensionl概念的定义l外延

4、extensionl概念所应用于的例子的集合概念类的三层意思When creating a domain model, it is usually the symbol and intensional view of a conceptual class that are of most practical interest.识别和提取概念类识别领域中的概念类Store, Register, Sale过度指定领域模型(带有大量细粒度的概念类)比不足好(越多越好)开始常会遗漏,在后面考虑属性、关联以及在设计阶段时,发现遗漏可随时补充Do not exclude a conceptual clas

5、s simply becauselIt has no attributeslthe requirements do not indicate any obvious need to remember information about it技巧l用概念类种类列表l识别名词短语l使用分析模式使用概念种类列表store and airline reservation domains.饥饿,恐高症识别名词和名词短语it is another source of inspiration.Care:la mechanical noun-to-class mapping isnt possiblelwor

6、ds in natural languages are ambiguouslit is recommended in combination with the Conceptual Class Category List technique.Some are candidate conceptual classesSome maybe ignored in this iteration (Accounting and commissions)Some may be attributes of conceptual classes.(Price)使用分析模式由专家创建并公开的部分领域模型销售领域

7、候选概念类Report ObjectsInclude Receipt in the Model?No-In general, showing a report of other information in a 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)l本次迭代未考虑退货,因而不包括

8、Receipt,处理Handle Returns的迭代中再考虑创建领域模型步骤列出候选概念类在领域模型中画出候选概念类添加关系添加属性几个问题命名mapmaker strategylMake a domain model in the spirit of how a cartographer or mapmaker works:l Use the existing names in the territory(地区,领域).l Exclude irrelevant features(地形图,人口分布)l Do not add things that are not there.also nam

9、ed the Use the Domain Vocabulary strategy常见错误将应该作为概念类的当做属性-规则:若在现实世界中我们不把X当作数字或文本,则X可能是概念类而不是属性If we do not think of some conceptual class X as a number or text in the real world, X is probably a conceptual class, not an attribute.If in doubt, make it a separate concept. Attributes should be fairly

10、rare in a domain model.解决相似概念A thing that records sales and payments,Register登记簿:la book that logged sales and payments.lcash register:收银机lAcquire a generalized meaning over time. POST: point-of-sale terminal.lIn computerese, a terminal is any end-point device in a system, such as a client PC, a wir

11、eless networked PDA, and so forth.as a rule of thumb, a domain model is not absolutely correct or wrong, but more or less useful; it is a tool of communication.解决相似概念登记簿Register和POST功能一样。但Register更抽象,POST更面向实现,是否应该用Register而不是POST?l各有优缺点mapmaker principle, “POST” is a term familiar in the territoryP

12、OST好,易于交流从模型的目的:抽象,实现独立Register好,Modeling the Unreal Worldsome candidate conceptual classes related to a telecom-munication switch: Message, Connection, Port, Dialog, Route, Protocol.添加Specification/ descriptionthe need for specification conceptual classes is common in many domain models.添加Specifica

13、tion/ description商品ItemItem具有price, and itemID,没有在其他地方记录物理商品被卖出,软件实例即删除cup1,cup2,cup3,全部售完,则没有了cup的记录,-Cup多少钱?无法回答a ProductSpecification (or ItemSpecification, ProductDescription .) conceptual class records information about itemsdoes not represent an Item, it represents a description of information

14、 about itemsit is common to state that an XSpecification Describes an X规则:使用Specification/ description的场合l当需要对Item或服务进行描述(独立于这些条目或服务当前存在的任何具体例子)时l删除实例会导致有用信息丢失时(这些信息和被删除的东西不恰当地关联在一起了)l要减少信息冗余common in sales , product, and manufacturing Domains又一例(服务)航班失事,则取消所有航班(service),所有Flight对象删除。则各个number的航班目的地

15、信息全部丢失,应该把number部分提取出来不同视角的模型同一种图可用于不同视角的模型Essential or conceptual perspectivel现实世界现实世界Specification perspectivel独立于语言的软件世界Implementation perspectivel具体语言实现解决语义鸿沟-用相同的名称representational gap or semantic gap Conceptual classlreal-world concept or thinglA conceptual or essential perspectivelThe UP Doma

16、in Model contains conceptual classes. Software classla class representing a specification or implementationlperspective of a software component, regardless of the process or method. Design classla member of the UP Design Modella synonym for software classleither a specification or implementation per

17、spective, as desired by the modeler.Implementation classla class implemented in an object-oriented language such as Java.Classlgeneral term lrepresenting either a real-world thing (a conceptual class) or software thing (a software class).POS系统领域模型领域模型和UP初始-no细化-l主要在此创建,当需要理解值得注意的概念,并映射到部分设计工作的类中l熟练者

18、每次迭代只需几小时来开发领域模型,若是用预定义的分析模式,还将更快The UP Business Object Model vs. Domain ModelBusiness Object ModellThe 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. RUPlrepresented with several dif

19、ferent diagrams (class, activity, and sequence)lillustrate how the entire enterprise runslmost useful if doing enterprise-wide business process engineering, Domain Modellmore commonly created subset artifact or specialization of the BOM.lYou can choose to develop an incomplete business object model,

20、 focusing on explaining things and products important to a domain. . This is often referred to as a domain model. RUP领域设计制品领域模型添加关联Criteria for Useful AssociationsConsider including the following associations in a domain model:l Associations for which knowledge of the relationship needs to be pre-se

21、rved for some duration (need-to-know associations).l Associations derived from the Common Associations List.Many lines on the diagram will add “visual noise” and make it less comprehensible尽量少加Need to knowTo reconstruct a sale, print a receipt, or calculate a sale total.the requirements do not sugge

22、st that any such relationship is needed.添加关联从常用关联列表中导出的关联-由此开始高优先级关联 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关联)提取概念类比识别关联更重要太多的关联会使领域模型更混乱l耗时,而效果递减l避免显示冗余或可导出的关联角色Each end of an association is called a r

23、ole.Roles may optionally have:lnamelmultiplicity expressionlNavigability(导航)MultiplicityThe multiplicity value communicates(表明) how many instances can be validly associated with another, at a particular moment, rather than over a span of time.l一夫一妻制中。任一时刻只能与一人结婚,但一段时间内可能与多人结婚l旧车任一时刻只能被一个经销商进货,但一段时间内

24、可能反复被进货The multiplicity value is dependent on our interest as a modeler and software developerl现实中,Item可以不存储在任何Store中(如已卖出),但软件中,Item总与一个Store相联系Naming AssociationsTypeName-VerbPhrase-TypeName formatlverb phrase creates a sequence that is readable and meaningful in the model context.lstart with a ca

25、pital letterlassociation represents a classifier of links between instances; in the UMLl两种常用格式lPaid-bylPaidBydefault direction to read an association name is left to right or top to bottomlnot a UML default, but a common convention.Multiple Associations Between Two TypesUnforgettable Relationships i

26、n the StoreApplying the Category of Associations Checklist添加关联领域模型添加属性包含什么样的属性任何针对属性的声明,应该在现实世界实体的语境中加以解释 领域模型中应该包含以下属性a receipt收银条 (which reports the information of a sale) lnormally includes a date and time, andlmanagement wants to know the dates and times of sales for a variety of reasons.l Conse

27、quently, the Sale conceptual class needs a date and time attribute.用关联 or 属性?属性简单数据类型关联复杂数据类型The type of an attribute should not normally be a complex domain conceptl such as a Sale or Airport.属性与代码实现 领域模型中属性用Simple data type, 不意味着OOPL中的属性也必须Simple, primitive data typeduring design and implementatio

28、n worklone of a number of possible design solutions to implement an associationlthe associations between objects expressed in the domain model will often be implemented as attributes that reference other complex software objectslthis is one solution, decision should be deferred during domain modelin

29、g.属性,data type,概念类Attribute (data type) Attributes should generally be data types.la UML term that implies a set of values for which unique identity is not meaningfulAttribute (data type)For example, it is not (usually) meaningful to distinguish between:l Separate instances of the Number 5.l Separat

30、e instances of the String cat.l Separate instances of PhoneNumber that contain the same number.l Separate instances of Address that contain the same address.only value-based comparisons are relevant.Conceptual classit is meaningful to distinguish (by identity) between two separate instances of a Per

31、son whose names are both Jill Smithcompare the memory addresses of Person instances,属性(data type) or 概念类?Make it an attributel if it is naturally thought of as number, string, boolean, date, or time (and so on)Otherwiselrepresent it as a separate conceptual class.If in doubtldefine something as a se

32、parate conceptual class rather than as anattribute.属性primitive data typelsuch as a number or stringnon-primitive data type.lPhoneNumberlalso known as value objectsla non-primitive classlData Type Classes促销价Universal Product Code (UPC) or European Article Number (EAN)以前作为Primitive data type的在以下情况下可能表

33、示为Non-primitive type应用以上原则尽管实例的唯一身份无意义,但仍值得作为单独的类item identifiernon-primitive ItemIDlabstractionlsubpartsprice and amount attributesnon-primitive Quantity or Money classesThe address attributea non-primitive AddressThere is no correct answerlA domain model is a tool of communication; choices about w

34、hat is shown should be made with that consideration in mind.属性与外键undesirable lbecause its purpose is to relate the Cashier to a Register object.Betterlrelate types with an association, not with an attribute.lThere are many ways to relate objectsforeign keys being oneldefer how to implement the relat

35、ion until designlto avoid design creep(creep, not anticipated near the start)数量与单位Most numeric quantities should not be represented as plain numbers.lprice or velocity 速度lThese are quantities with associated units,Solution( In the general case,)lrepresent Quantity as a distinct conceptual class, with an associated UnitQuantities are considered data types (unique identity of instances is not important)lit is acceptable to collapse their illustration into the attribute section of the class boxMultiplicity From SalesLineItem to Item添加属性

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 资格认证/考试 > 自考

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号