敏捷建模Agile Modeling – 类图的草图
– 是否利用工具建模
创建领域模型的目的是快速地理解关键的概念,并在涉众之间交流
the purpose of creating a domain model is to quickly understand and communicate of the key concepts 完美不是目标 Perfection is not the goal
是否利用工具,酌情 For tool, may or not
报告性的、或者总结性的对象,是否定义为概念 Report Objects / summary object : to be an concept
E.g. Include 'Receipt' in the Model?
In general, showing a report of other information in a domain model is not useful since all its information is derived or duplicated from other sources
This is a reason to exclude it
On the other hand, it has a special role in terms of the business rules:
It usually confers the right to the bearer of the (paper) receipt to return bought items (顾客退货的凭据)
This is a reason to show it in the model Guideline
构建领域模型,类似地图制作
使用现有的名词 Use the existing names in the territory
For example, if developing a model for a library, name the customer a "Borrower" or "Patron” the terms used by the library staff
剔除掉无关的、或者超出范围的一些特征 Exclude irrelevant or out-of-scope features
例如,在课程的案例“大富翁游戏 Monopoly”,第一次迭代中,有些概念,如各类卡 片 cards (“免进 监狱Get out of Jail Free” card) 暂不考虑,所以就不显示“Card”
不需要额外增加没必要的概念!Do not add things that are not there
如何对非真实世界的概念建模
有些软件系统着眼于解决领域问题,但是在现实中或者业务中很少有概念与之对应
例如,电信领域“交换机”相关的概念
消息、连接、端口、对话、路由、协议 Message, Connection, Port, Dialog, Route, Protocol
经常容易出错的选择:Attributes vs. Classes ,原则:
如果认为某概念类X不是现实世界中的数字或文本,那么X可能是概念类而不是属性
如果符合下列条件,可能是一个类
有很多元素构成 Composed of multiple elements (has attributes-states)
有一些操作、行为 There are operations (behavior)
有数量单位 Has units of quantity
例如
Store ?
consider the domain of airline reservations. Should destination be an attribute of Flight, or a separate conceptual class Airport ?
对一些描述‘Description’性质的概念建模
A description class contains information that describes something else
For example, a ProductDescription that records the price, picture, vendor, and text description of an Item
为什么单独作为概念类
Where to find product information when they were sold out 商品卖光了之后, 到哪里去找商品的信息 呢
Each Product of same type has its product description information, is there any problem 如果每一个 同类产品的信息都含有产品描述,有什么问题吗
Repeat, redundant, inconsistency, and a waste of storage space 重复、累赘,不 一致、浪费存 储空间
定义成“描述”类的原则
如果描述内容独立于对应 的事物 ,如产品、产品 描述
如果删除对象的同时删除 了描述,而该描述还需要 继续维护
为了减少重复或者更清晰