JWorld@TW the best professional Java site in Taiwan
      註冊 | 登入 | 全文檢索 | 排行榜  

» JWorld@TW » Software Engineering  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友    訂閱主題
reply to topicthreaded modego to previous topicgo to next topic
本主題所含的標籤
無標籤
作者 generic v.s. instance sequence diagrams
worookie

Small Ship

版主

發文: 2092
積分: 21
於 2003-09-13 08:14 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
底下聯結的文章是 popcorny 提供的
http://www-106.ibm.com/developerworks/java/library/j-jmod0605/
裡面提到 sequence diagrams 分成兩種: generic 和 instance

(1) generic sequence diagram:



請注意上圖中 Account 的表示式, 沒有用到冒號 ":"

(2) instance sequence diagram:



請注意上圖中 myAccount:Account 的表示式

那麼依照其分類, 我之前畫的圖:



之中的 :MyAccount (請注意其有用到冒號 ":") 是屬於 generic 還是 instance 的呢?
謝謝
P.S. 我查了 UML 1.5 spec 但找不到進一部的資料


worookie edited on 2003-09-13 08:18
reply to postreply to post
作者 Re:generic v.s. instance sequence diagrams [Re:worookie]
Biologic

生物學下的產物



發文: 524
積分: 4
於 2003-09-13 09:01 user profilesend a private message to usersend email to Biologicreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
worookie wrote:
底下聯結的文章是 popcorny 提供的
http://www-106.ibm.com/developerworks/java/library/j-jmod0605/
裡面提到 sequence diagrams 分成兩種: generic 和 instance

(1) generic sequence diagram:



請注意上圖中 Account 的表示式, 沒有用到冒號 ":"

(2) instance sequence diagram:



請注意上圖中 myAccount:Account 的表示式

那麼依照其分類, 我之前畫的圖:



之中的 :MyAccount (請注意其有用到冒號 ":") 是屬於 generic 還是 instance 的呢?
謝謝
P.S. 我查了 UML 1.5 spec 但找不到進一部的資料


那是你 tool 的問題. 既然沒有名稱 你可以當作是 generic.


reply to postreply to post
作者 Re:generic v.s. instance sequence diagrams [Re:Biologic]
Biologic

生物學下的產物



發文: 524
積分: 4
於 2003-09-13 09:03 user profilesend a private message to usersend email to Biologicreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
Biologic wrote:
那是你 tool 的問題. 既然沒有名稱 你可以當作是 generic.


那個 generic/instance 是屬於哪個系統的啊? 還是每個 Modelling language 都有分 generic/instance?


reply to postreply to post
作者 Re:generic v.s. instance sequence diagrams [Re:worookie]
ymshin





發文: 277
積分: 4
於 2003-09-13 09:31 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
UML1.5 spec. 3.39 有提到 object notation, "The Elements of UML Style" 2.1 是說
objectname:classname 的 objectname 是 optional, 不過最好寫免得不清楚, 所以 wo 大的 :MyAccount 應該是一個 instance.


reply to postreply to post
作者 Re:generic v.s. instance sequence diagrams [Re:Biologic]
worookie

Small Ship

版主

發文: 2092
積分: 21
於 2003-09-13 09:35 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
Biologic wrote:
那是你 tool 的問題.

可是我用過的所有 tools 都是這樣畫啊


reply to postreply to post
作者 Re:generic v.s. instance sequence diagrams [Re:worookie]
anthonycs



版主

發文: 1195
積分: 6
於 2003-09-13 14:26 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
worookie wrote:
底下聯結的文章是 popcorny 提供的
http://www-106.ibm.com/developerworks/java/library/j-jmod0605/
裡面提到 sequence diagrams 分成兩種: generic 和 instance

[略]

那麼依照其分類, 我之前畫的圖:



之中的 :MyAccount (請注意其有用到冒號 ":") 是屬於 generic 還是 instance 的呢?
謝謝
P.S. 我查了 UML 1.5 spec 但找不到進一部的資料


我在學UML的時候也想過這個問題耶
老師當時給我的回答是 " 有冒號代表instance沒錯,沒寫名稱沒關係 "
我聽到他這樣說之後覺得,既然這樣子幹嘛要寫名稱,反正這是analysis階段的工作,寫程式的人不一定會照著給同樣的名稱。

看了一下米花兄給的連結,裡面說 :
The second form of sequence diagram is the instance form. An instance sequence diagram describes a single possible exchange of messages between two instances. Such a diagram will contain a variable name and its class type in the boxes along the horizontal axis, as seen in Figure 2. This form does not include the loops, conditions, or branches found in the generic form. In the actual flow of control in the system, certain assertions made in the course of the interaction may be found to be false. If an assertion is found to be false, any messages within the instance sequence diagram are void and the scenario will not occur. The instance sequence diagram describes a single scenario that may or may not occur.

這個使用方式我以前沒聽說過耶,instance是用在這個時機嗎?
我最感到疑惑的是什麼時候用instance,什麼時候用generic。是不是有些情況用instance有特別意義。
像worookie大大畫的圖,calcBalance()需要iteraction,這個時候MyAccount應該是instance還是generic?

有沒有人給小弟解惑一下


reply to postreply to post
作者 Re:generic v.s. instance sequence diagrams [Re:worookie]
anthonycs



版主

發文: 1195
積分: 6
於 2003-09-13 14:28 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
worookie wrote:
可是我用過的所有 tools 都是這樣畫啊


together預設都是有冒號嗎?
我剛剛試了一下,在Rose 2002的Use Case View畫sequence diagram沒有冒號 >_<
jude1.2.2也沒有~ 都要自己加上去


reply to postreply to post
作者 Re:generic v.s. instance sequence diagrams [Re:anthonycs]
worookie

Small Ship

版主

發文: 2092
積分: 21
於 2003-09-13 14:57 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
anthonycs wrote:
together預設都是有冒號嗎?
jude1.2.2也沒有~ 都要自己加上去


之前 popcorny 和我好像就是看到你的冒號是自己加上去的, 才會說你熊暴力.
因為你所有的 classes 都還沒定義啊, jude 當然就沒辦法幫你自動加冒號啊.

但是現在我被 generic/instance 搞混了, 我也不確定到底誰對誰錯了.

附上你之前的圖如下:


reply to postreply to post
作者 Re:generic v.s. instance sequence diagrams [Re:worookie]
anthonycs



版主

發文: 1195
積分: 6
於 2003-09-13 15:02 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
worookie wrote:
之前 popcorny 和我好像就是看到你的冒號是自己加上去的, 才會說你熊暴力.
因為你所有的 classes 都還沒定義啊, jude 當然就沒辦法幫你自動加冒號啊.


了解~ 謝謝解惑!! ^^


但是現在我被 generic/instance 搞混了, 我也不確定到底誰對誰錯了.


不過至少知道instance name沒註明是ok的。
用在什麼時機再找看看囉~


reply to postreply to post
作者 Re:generic v.s. instance sequence diagrams [Re:anthonycs]
anthonycs



版主

發文: 1195
積分: 6
於 2003-09-13 15:15 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
anthonycs wrote:
了解~ 謝謝解惑!! ^^

不過至少知道instance name沒註明是ok的。
用在什麼時機再找看看囉~



註:我們老師上課用instance的表示法用很兇。參考書上也幾乎都是用instance.

這一本


amazon上的介紹 http://www.amazon.com/exec/obidos/tg/detail/-/0077098641/qid=1063437592/sr=1-61/ref=sr_1_61/102-1095241-5035363?v=glance&s=books


anthonycs edited on 2003-09-13 15:24
reply to postreply to post
作者 Re:generic v.s. instance sequence diagrams [Re:anthonycs]
Biologic

生物學下的產物



發文: 524
積分: 4
於 2003-09-13 16:06 user profilesend a private message to usersend email to Biologicreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
anthonycs wrote:
我在學UML的時候也想過這個問題耶
老師當時給我的回答是 " 有冒號代表instance沒錯,沒寫名稱沒關係 "
我聽到他這樣說之後覺得,既然這樣子幹嘛要寫名稱,反正這是analysis階段的工作,寫程式的人不一定會照著給同樣的名稱。

看了一下米花兄給的連結,裡面說 :
The second form of sequence diagram is the instance form. An instance sequence diagram describes a single possible exchange of messages between two instances. Such a diagram will contain a variable name and its class type in the boxes along the horizontal axis, as seen in Figure 2. This form does not include the loops, conditions, or branches found in the generic form. In the actual flow of control in the system, certain assertions made in the course of the interaction may be found to be false. If an assertion is found to be false, any messages within the instance sequence diagram are void and the scenario will not occur. The instance sequence diagram describes a single scenario that may or may not occur.

這個使用方式我以前沒聽說過耶,instance是用在這個時機嗎?
我最感到疑惑的是什麼時候用instance,什麼時候用generic。是不是有些情況用instance有特別意義。
像worookie大大畫的圖,calcBalance()需要iteraction,這個時候MyAccount應該是instance還是generic?

有沒有人給小弟解惑一下


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
class myDearJiaYun {
 
  private Lady onlyQueen=new JiaYun();
 
  public void tellMeYourQueen(){
    System.out.println(onlyQueen.getName());
/*
  As you see, this must use instance diagram, or at least for JiaYun Lady must be named.
*/
  }
 
  public void tellPllWhoIsThisLady(Lady lady){
    if (onlyQueen==lady) 
      System.out.println("Our highness:"+lady.getName());
    else
      System.out.println(lady.getName());
/*
  As you see, no one cares who it was. Just show her name.
*/
  }
 
}


如果有女學生覺得有什麼不懂 歡迎私下找我~~


Biologic edited on 2003-09-13 16:14
reply to postreply to post
作者 Re:generic v.s. instance sequence diagrams [Re:worookie]
Akilover



發文: 0
積分: 0
於 2003-09-15 13:31 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
楼上兄台蛮搞笑的,性别歧视啊:)

记得我做object diagram的时候,很明确object就是一个class在某个特定
时候的表现,他可以表示一个class在不同时候属性可能有的不同植

对于sequance diagram, 既然是时序图那更多的时候都是针对某一个时间
段内对于不同class之间的调用做一个描述,所以最好是有“:”号

generic sequance 是反映一些类普遍存在的调用关系,对于某一时刻类成员
变量的状况并不是很关心,因此也不会知道object name。

对于 instance sequance , object name 只是这个类的一个很平常的属性
也可以是人为定义的一个名称,用于反映类当时的一个概况。有与无都可以
要区分两个diagram的区别,实际上还是看这个时序图是不是关心类的状态
关不关心类的具体成员变量的变化,是不是针对某一个特定的实例。


reply to postreply to post
作者 Re:generic v.s. instance sequence diagrams [Re:Akilover]
Biologic

生物學下的產物



發文: 524
積分: 4
於 2003-09-15 13:42 user profilesend a private message to usersend email to Biologicreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
Akilover wrote:
楼上兄台蛮搞笑的,性别歧视啊:)

记得我做object diagram的时候,很明确object就是一个class在某个特定
时候的表现,他可以表示一个class在不同时候属性可能有的不同植

对于sequance diagram, 既然是时序图那更多的时候都是针对某一个时间
段内对于不同class之间的调用做一个描述,所以最好是有“:”号

generic sequance 是反映一些类普遍存在的调用关系,对于某一时刻类成员
变量的状况并不是很关心,因此也不会知道object name。

对于 instance sequance , object name 只是这个类的一个很平常的属性
也可以是人为定义的一个名称,用于反映类当时的一个概况。有与无都可以
要区分两个diagram的区别,实际上还是看这个时序图是不是关心类的状态
关不关心类的具体成员变量的变化,是不是针对某一个特定的实例。


You seem to be talking to me... but sorry I can't read...


reply to postreply to post
作者 Re:generic v.s. instance sequence diagrams [Re:worookie]
Akilover



發文: 0
積分: 0
於 2003-09-15 14:18 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
I see, only the first sentence is talking abort you.
I mean you are humourous since you are only be glad to solve problems
for female students.

Others are discussing generic/instance sequence diagram.


reply to postreply to post
» JWorld@TW »  Software Engineering

reply to topicthreaded modego to previous topicgo to next topic
  已讀文章
  新的文章
  被刪除的文章
Jump to the top of page

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8