软件工程-12领域模型-概念的可视化课件_第1页
软件工程-12领域模型-概念的可视化课件_第2页
软件工程-12领域模型-概念的可视化课件_第3页
软件工程-12领域模型-概念的可视化课件_第4页
软件工程-12领域模型-概念的可视化课件_第5页
已阅读5页,还剩124页未读 继续免费阅读

下载本文档

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

文档简介

1、领域模型-概念的可视化领域模型概念的可视化Content什么是领域模型概念类识别和提取概念类创建领域模型步骤几个问题命名概念类or属性?相似概念问题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概念模型领

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

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

4、思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 class simply becauseIt has no att

5、ributesthe requirements do not indicate any obvious need to remember information about it技巧用概念类种类列表识别名词短语使用分析模式使用概念种类列表store and airline reservation domains.饥饿,恐高症识别名词和名词短语it is another source of inspiration.Care:a mechanical noun-to-class mapping isnt possiblewords in natural languages are ambiguou

6、sit 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)使用分析模式由专家创建并公开的部分领域模型销售领域候选概念类Report ObjectsInclude Receipt in

7、 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)本次迭代未考虑退货,因而不包括Receipt,处理Handle Returns的迭代中再考虑创建领域模型步

8、骤列出候选概念类在领域模型中画出候选概念类添加关系添加属性几个问题命名mapmaker strategyMake a domain model in the spirit of how a cartographer or mapmaker works: Use the existing names in the territory(地区,领域). Exclude irrelevant features(地形图,人口分布) Do not add things that are not there.also named the Use the Domain Vocabulary strategy常

9、见错误将应该作为概念类的当做属性-规则:若在现实世界中我们不把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 rare in a domain model.解决相似概念A thing that

10、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.as a rule of

11、 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?各有优缺点mapmaker principle, “POST” is a term familiar in the territoryPOST好,易于交流从模型的目的:抽象,实现独立Register好,Modeling the U

12、nreal 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.添加Specification/ description商品ItemItem具有price, and itemID,

13、没有在其他地方记录物理商品被卖出,软件实例即删除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 about itemsit is common to state that an XSpec

14、ification Describes an X规则:使用Specification/ description的场合当需要对Item或服务进行描述(独立于这些条目或服务当前存在的任何具体例子)时删除实例会导致有用信息丢失时(这些信息和被删除的东西不恰当地关联在一起了)要减少信息冗余common in sales , product, and manufacturing Domains又一例(服务)航班失事,则取消所有航班(service),所有Flight对象删除。则各个number的航班目的地信息全部丢失,应该把number部分提取出来不同视角的模型同一种图可用于不同视角的模型Essenti

15、al or conceptual perspective现实世界Specification perspective独立于语言的软件世界Implementation perspective具体语言实现解决语义鸿沟-用相同的名称representational gap or semantic gap Conceptual classreal-world concept or thingA conceptual or essential perspectiveThe UP Domain Model contains conceptual classes. Software classa class

16、representing a specification or implementationperspective of a software component, regardless of the process or method. Design classa member of the UP Design Modela synonym for software classeither a specification or implementation perspective, as desired by the modeler.Implementation classa class i

17、mplemented in an object-oriented language such as Java.Classgeneral term representing either a real-world thing (a conceptual class) or software thing (a software class).POS系统领域模型领域模型和UP初始-no细化-主要在此创建,当需要理解值得注意的概念,并映射到部分设计工作的类中熟练者每次迭代只需几小时来开发领域模型,若是用预定义的分析模式,还将更快The UP Business Object Model vs. Doma

18、in ModelBusiness 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. RUPrepresented with several different diagrams (class, activity, and sequence)illustrate how the entire

19、 enterprise runsmost useful if doing enterprise-wide business process engineering, Domain Modelmore commonly created subset artifact or specialization of the BOM.You can choose to develop an incomplete business object model, focusing on explaining things and products important to a domain. . This is

20、 often referred to as a domain model. RUP领域设计制品领域模型添加关联Criteria for Useful AssociationsConsider including the following associations in a domain model: Associations for which knowledge of the relationship needs to be pre-served for some duration (need-to-know associations). Associations derived from

21、 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 suggest that any such relationship is needed.添加关联从常用关联列表中导出的关联-由此开始高优先级关联 A is a ph

22、ysical 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:namemultiplicity expressionNavigability(导航)Multipl

23、icityThe 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

24、developer现实中,Item可以不存储在任何Store中(如已卖出),但软件中,Item总与一个Store相联系Naming AssociationsTypeName-VerbPhrase-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两种

25、常用格式Paid-byPaidBydefault direction to read an association name is left to right or top to bottomnot a UML default, but a common convention.Multiple Associations Between Two TypesUnforgettable Relationships in the StoreApplying the Category of Associations Checklist添加关联领域模型添加属性包含什么样的属性任何针对属性的声明,应该在现实

26、世界实体的语境中加以解释 领域模型中应该包含以下属性a receipt收银条 (which reports the information of a sale) normally includes a date and time, andmanagement 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.用关联 or 属性?属性简单数据类型关联复杂数据类型The

27、 type of an attribute should not normally be a complex domain concept such as a Sale or Airport.属性与代码实现 领域模型中属性用Simple data type, 不意味着OOPL中的属性也必须Simple, primitive data typeduring design and implementation workone of a number of possible design solutions to implement an associationthe associations be

28、tween objects expressed in the domain model will often be implemented as attributes that reference other complex software objectsthis is one solution, decision should be deferred during domain modeling.属性,data type,概念类Attribute (data type) Attributes should generally be data types.a UML term that im

29、plies a set of values for which unique identity is not meaningfulAttribute (data type)For example, it is not (usually) meaningful to distinguish between: Separate instances of the Number 5. Separate instances of the String cat. Separate instances of PhoneNumber that contain the same number. Separate

30、 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 Person whose names are both Jill Smithcompare the memory addresses of Person instances,属性(data type) or 概念类?

31、Make it an attribute if it is naturally thought of as number, string, boolean, date, or time (and so on)Otherwiserepresent it as a separate conceptual class.If in doubtdefine something as a separate conceptual class rather than as anattribute.属性primitive data typesuch as a number or stringnon-primitive data type.PhoneNumberalso known as value objectsa non-primitive classData Type Classes促销价Universal Product Code (UPC) or European Article Number (EAN)以前作为Primitive data type的在以下情况下可能表示为Non-primitive type应用以上原则尽管实例的唯一身份无意义,但仍值得作为单独的类item identifierno

温馨提示

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

评论

0/150

提交评论