六类UML图

1.Five famous and freeUML tools:

JUDE:

UMLLet: model rapidly and export manyformats, such as SVG, JPG and LaTEX-friendly EPS.

Argo UML: It can run in the platform of Java and support10 localized language and comply with the BSD agreement.

BOUml:

Visual paradigm – community:

 

2. Why we use UML modeling? Or what UML is?

Model simplies and simulates the real world’s state so thatit can provides the blueprint or skeleton of the system.

◆ model helps inaccordance with the actual situation, or in accordance with the style of thesystem needed to be visualized.

 

◆ model can statute thestructure or behavior of the system.

 

◆ model gives a templateto guide the structure of the system.

3.six maindiagrams of UML

This part I will mainly talk about theusage of the 6 diagrams

1.      The class diagram (or structurediagram),of the 6 diagrams, I prefer the class diagram.

1)      Class:if some objects have thesame structures, behaviors, restrain and semantics, then we can call they arein the same class. n a class, we use attribute to stand for its structure andoperation for its behaviors what we have learn in the software design course,.

2)      How to draw a class diagram:Using a rectangle with three cells, put the name of the class at the top, whilethe attribute in the middle and operation in the bottom.

Sometimes we can hide attribute or operation so as to savespace.

3)      Encapsulation: class can hidethe data structure and behavior detail with the help of attribute andoperation. Moreover, class can set visibility of these members, so that we callthe class set the encapsulation.

UML set 4 encapsulation4, those are public, private,protected and package. The symbol “-“ stands for private , “+” stands forpublic and “#” stands for protected .As for package, using the symbol “~”, theclasses can see each other’s attribute and operations if they are in the samepackage. Like this, branch can’t see the information since they are not in thesame package.

4)      Association. It is the relationbetween two or more objects while the objects can come for the same class ordifferent class. For example, person and company in different class, but if theobjects come from the same class, they must be different instance, like bossand employee.

They are binary association andn-ary associatio using the diamond to link the objects.

Attention, the direction of the arrow means the navigationfrom source end to the target end.

AB is associated with each other ,CD both  don’t have the navigation while it didn’t tellus the navigation of EF, GH is one-way link form G to H,

5)      Multiplicity

multiplicity element tell the max numberand the min number of the elements, while symbol “*” stands for no ceiling anda lower limit 0.

For example, a custom can have many accounts, buta account must belong to just one custom.

6)      Aggregation and composition

Aggregation : the overall and partial part have a weak relation, the parts’ life cycle can be more than the overall., like the computer andmouse.

Composition: the overall and partial part have a strong relation, the parts’ life cycle can’t be more than the overall, like the person andeyes.

 

7)      Generalization .

We also call inheritance, but in UML, we don’t usual callthis name. Through generation, we can divide the class to superclass and subclass.

8)      Dependency

One element is dependent to another if it changes by theanother element’s transformation. For example, you must have the money(or CreditCard) to check out, then they have the relation of dependency.

9)      Interface.

It is like the contract of the class, thatmeans the class have to obey the rules to realize the public operation andmaintain the public attribute.

They are providedinterface and required interface.(using the half cicle symbol)

10)  Comments(a fold rectangle)

2.      Object class

1)using rectangle too. But the name of the object isusually hidden. (the symbol “:” and the class name)

The relation between two objects is link.

3.      package diagram

1)    the rectangle of the same size. Just like a bigbox includes the elements

2)      element import

The program import the Time data type by the arrow withdotted line.

3)      Package import

It is like the element import, but just import the wholebox.

4)      Package merge

(A—原先的A,加上Q::A。假设原先的A有一个名为name的属性,而Q::A拥有一个名为 address的属性,合并后的新A将同时拥有name和address两个属性。)

4.      use case diagram

1) the diagram includes actor ,stakeholder and theuse case, it is usually used  to expressthe requirement and behaviors of the system.

2) the include relation. The base use case can bedefined in the included case, if that ,then the included case must be executed.

3) extend relation.(it is not the necessary flow.)

4) Extension point.

(扩展关系通常会搭配扩展点(extension point)来指明扩展的时机点。以图2-63为例,提款用例记载了名为打印(print)的扩展点,意味着打印收据(print receipt)的行为会插入到打印扩展点处。)

2.5活动图

  活动图是一款行为图(behaviordiagram),如图2-34所示,通常用来表达业务流程、工作流或系统流程中一连串的动作。

  如图2-35所示,这是一张简单的活动图,用来表达订单的流程。接到订单(receiveorder)后,决定是否接受这张订单。接受(orederaccepted),就出货(shiporder);不接受(orderrejected),则结束订单(closeorder)。

  

  图2-34活动图

  

  图2-35活动图

  活动图涵盖的概念和图示非常繁杂,在接下来的各小节中,会谈到使用比较多的概念。

  2.5.1动作与控制流

  在活动图中,动作(action)是最重要的组成元素,它代表一个执行步骤。动作的图示是圆角矩形,如图2-36所示。

  连接动作的带箭头实线称为控制流(controlflow)。当来源动作结束之后,控制流会启动目标动作。如图2-37所示,寄送发票(sendinvoice)的动作执行完之后,会通过控制流启动付款(makepayment)动作。

  

  图2-36动作

  

  图2-37控制流

  2.5.2对象节点与对象流

  对象节点(objectnode)为矩形图示,对象流(objectflow)的图示与控制流相同,不过它的其中一个端点必须是对象节点,而另一端必须是其他节点。控制流的两个端点不可以都是对象节点。

  对象流不同于控制流,对象流可以携带数据或对象。若在寄送发票动作结束后,一并传送发票(invoice)到付款处,可以通过对象流,如图2-38所示。

  

  图2-38对象流

  2.5.3活动参数节点

  一般的对象节点出现在活动范围内。如果将对象节点当成活动的参数,用于输入或输出活动,就可以改用活动参数节点(activityparameter node)。

  如图2-39所示的范例,放置于活动边框上的三个矩形都是活动参数节点。订单(order)、信用卡(card)和发票(invoice)都是订购处理(orderprocess)活动的参数,它们分别属于Order、CreditCard和Invoice类型。

  

  图2-39活动参数节点

  2.5.4引脚

  引脚(pin)和活动参数节点很像,两者都作为输入/输出使用。差别在于引脚用在动作处,活动参数节点则用在活动处。引脚会提供值(values)给动作,且从动作处接受返回值。

  引脚有两种,一种称为输出引脚(outputpin),另一种称为输入引脚(inputpin)。如图2-40所示,输出引脚用来保存动作的输出值,输入引脚则用来保存动作的输入值。如果想一眼就辨识出输出/输入引脚,也可以采用图2-41的表示法,附箭头的引脚。箭头朝动作外的引脚为输出引脚;箭头朝动作内的引脚为输入引脚。

  

  图2-40输出引脚与输入引脚

  

  图2-41带有箭头的引脚

  有一种特殊的输入引脚,没有进入线,可以自行提供值,这种输入引脚称为值引脚(value

  pin)。以图2-42为例,填写订购交易(fillorder)的日期永远都是当日(today)。所以,适合使用值引脚来提供固定的值。值引脚的图示与输入引脚相同,但是需在引脚旁边标记值。

  

  图2-42值引脚

  2.5.5起点与终点

  起始节点(initialnode)代表活动流程的起点,整个活动由起始节点开始循着活动边的箭头方向前进。如图2-43所示,起始节点的图示是实心小圆,它没有进入线,但是可以有多条离开线。有始有终,有起始节点,当然就会有终止节点(finalnode)。UML定义了两种终止节点,如图2-44所示,其一是活动终点(activityfinal),代表整个活动的终止;另一种是流终点(flowfinal),代表单一条支流的终止。

  

  图2-43起始节点

  

  图2-44活动终点与流终点

  活动终点可以有多条进入线,但是无离开线,如图2-45所示。一个活动也可以有多个活动终点,但是任何一条活动边进入任何一个活动终点时,所有支流都会被终止。

  

  图2-45活动终点

  2.5.6合并

  一座山有很多条不同的步道,时而交汇,时而分离。活动流程中,也需要这样的流程交汇点,称为合并节点(mergenode)。可以想见,一个合并节点会有多条进入线,但是只有一条离开线,如图2-46所示,合并节点的图示是大的空心菱形,所有进入合并节点的支流都会经历同一条离开线。

  

  图2-46合并节点图示

  2.5.7判断

  判断节点(decisionnode)与合并节点共用图示,两者都是大的空心菱形。不过,判断节点只有一个进入线,但有多条离开线,如图2-47所示,刚好跟合并节点相反。

  

  图2-47判断节点图示

  虽然判断节点有多条离开线,但只有其中一条离开线可以通过警戒条件(guard)进入下一个活动节点,如图2-48所示。所以,判断节点的离开线上都会附有警戒条件,用来决定一条离开路径。

  

  图2-48判断节点与警戒条件

  2.6序列图

  序列图用来表达系统内部一群对象的交互情况,它是一种行为图,如图2-49所示。

  

  图2-49序列图

  在接下来的各小节中,仅谈论序列图中常见的概念及图示。

  2.6.1交互

  交互(interaction)是一个行为单元(behaviorunit),用来呈现一群对象互相交换信息的情况。如图2-50所示,使用大方框将一群对象围起来,代表一个交互单元,在大方框内部左上角的框内标示带有关键字sd的交互名称。

  

  图2-50交互

  序列图通常省略交互的大方框,一张序列图的内容就是一个交互单元。既然交互是一个行为单元,当然希望可以重用(reuse)预先设计好的交互,通过组合多个交互单元,形成另一个更大的交互单元。

  2.6.2生命线

  生命线(lifeline)代表一个参与交互的实例,它的图示是顶端连接矩形的虚线,如图2-51所示,虚线顶部的矩形可以放置生命线的名称。

  

  图2-51生命线

  2.6.3执行发生

  对象在接收到消息之后执行一项活动,执行期间称为执行发生(executionoccurrence),如图2-52所示,它的图示是长条矩形。

  

  图2-52执行发生

  2.6.4消息

  消息(message)的图示是一条带箭头的线段,横跨在两个生命线上,如图2-53所示,对象之间通过发送消息来交互。

  

  图2-53消息

  如图2-54所示,序列图中有四种常见的消息,说明如下:

  •创建消息(createMessage)—顾名思义,用来创建对象的消息称为创建消息。它的图

  示是带开放性箭头的虚线,箭头指向目标对象。

  •同步调用(synchCall)—这是最常见的消息。它的图示是带实心箭头的实线,由发送

  消息的来源对象指向负责执行的目标对象。

  •回复消息(replyMessage)—目标对象执行结束时,会发出回复消息给来源对象。它的

  图示是带开放式箭头的虚线,从负责执行的目标对象反向指回来源对象。

  •异步信号(asynchSignle)—同步与异步的差别在于,来源对象是否等待目标执行结束

  才继续往执行。来源对象如果发送同步消息,会等待,如果发送异步消息,就不等待了。

  

  图2-54四种消息

  2.6.5终止

  生命线有生有灭,终止(stop)就是用来表达生命线终止的时刻。终止的图示是一个大叉,放置在生命线的虚线底部,代表生命线已经终止,可连接元素已经不存在,如图2-55所示。

  

  图2-55终止

  2.6.6一般次序

  通常,不同生命线上的事件的发生顺序互不相干。但是,如果想指定顺序,就得使用一般次序(generalordering)。一般次序的图示为中间附箭头的虚线,如图2-56所示,:C接到消息p之后,:O才会发送消息q给:E。

  

  图2-56一般次序

  2.6.7状态不变式

  状态不变式(stateinvariant)是一种用在生命线上的约束(constraint)。以图2-57为例,购物刷卡时,金额(amount)不能超过信用额度(availablecredit)。可以在信用卡(creditcard)生命线处放置状态不变式。

  

  图2-57状态不变式

4.Reference

http://developer.51cto.com/art/200908/146071.htm

 

http://blog.csdn.net/tianhai110/article/details/6339565

 

http://developer.51cto.com/art/201006/204498.htm

 

http://dev.yesky.com/464/8642464.shtml

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
YOLO高分设计资源源码,详情请查看资源内容中使用说明 YOLO高分设计资源源码,详情请查看资源内容中使用说明 YOLO高分设计资源源码,详情请查看资源内容中使用说明 YOLO高分设计资源源码,详情请查看资源内容中使用说明YOLO高分设计资源源码,详情请查看资源内容中使用说明YOLO高分设计资源源码,详情请查看资源内容中使用说明YOLO高分设计资源源码,详情请查看资源内容中使用说明YOLO高分设计资源源码,详情请查看资源内容中使用说明YOLO高分设计资源源码,详情请查看资源内容中使用说明YOLO高分设计资源源码,详情请查看资源内容中使用说明YOLO高分设计资源源码,详情请查看资源内容中使用说明YOLO高分设计资源源码,详情请查看资源内容中使用说明YOLO高分设计资源源码,详情请查看资源内容中使用说明YOLO高分设计资源源码,详情请查看资源内容中使用说明YOLO高分设计资源源码,详情请查看资源内容中使用说明YOLO高分设计资源源码,详情请查看资源内容中使用说明YOLO高分设计资源源码,详情请查看资源内容中使用说明YOLO高分设计资源源码,详情请查看资源内容中使用说明YOLO高分设计资源源码,详情请查看资源内容中使用说明YOLO高分设计资源源码,详情请查看资源内容中使用说明YOLO高分设计资源源码,详情请查看资源内容中使用说明YOLO高分设计资源源码,详情请查看资源内容中使用说明YOLO高分设计资源源码,详情请查看资源内容中使用说明YOLO高分设计资源源码,详情请查看资源内容中使用说明YOLO高分设计资源源码,详情请查看资源内容中使用说明YOLO高分设计资源源码,详情请查看资源内容中使用说明

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值