离弦之Ray

  BlogJava :: 首页 :: 联系 :: 聚合  :: 管理
  55 Posts :: 0 Stories :: 33 Comments :: 0 Trackbacks
 

基础概念——Class Modeling

OO的概念——这就不多说了


三种模型

class model——描述object的结构

state model——描述单个object的行为

interaction model——描述object之间的互动行为


Class Model

单个的class图很简单


首先是类名、然后是属性,最后是方法。

前面的+表示public-表示private#表示protected


Association


形式上Association就是一根线,表示两个类之间的关系,线上可以标明Association的名字,两端可以标上multiplicity1表示one"1..*"表示one or more"3..5"表示three to five

"*"表示many

两个类之间可以有多于一个Association,但一般不常用


Association End Names


Association
的两端可以标上两个类在这个关系中的角色

这在两个类的关系中作用可能不是特别明显,但如果相关的双方属于同一个类


Association两端可以加很多限制



等等,还有Bags对应于sequence,没有先后次序。


Qualified Association


首先是没有Qualified


然后是Qualified



N-ary Association


Generalization

具体在编程语言中,就是继承关系


很简单不多说


Association->Aggregation->Composition


Aggregation表现的是一种part-whole的关系


Composition


Composition
Aggregation的区别是part只能属于一个Assembly

可以说Association->Aggregation->Composition关系一层强过一层


Abstract Class 类名用斜体字


属性有一种叫做Derived Data,它的意思是这个属性是被其它属性或类导出来的,被其它elements所决定,符号是在这个属性前面加上斜杠


如上图中,agebirthdate currentDate所决定。

最后一种图示,就是package


posted on 2007-10-15 11:30 离弦之ray的技术天空 阅读(699) 评论(0)  编辑  收藏 所属分类: Model

只有注册用户登录后才能发表评论。


网站导航: