210 likes | 447 Views
Key Terms. Object Message flow Procedure call flow of control Asynchronous flow of control Flat flow of control call Return flow a procedure call Message Label Condition Creation Destroy. Basic. Interaction diagram Collaboration diagram Link Active object Sequence diagram
E N D
Key Terms • Object • Message flow • Procedure call flow of control • Asynchronous flow of control • Flat flow of control call • Return flow a procedure call • Message • Label • Condition • Creation • Destroy Basic • Interaction diagram • Collaboration diagram • Link • Active object • Sequence diagram • Lifeline • Focus of control • Branching • Message with transaction time
Notation and Semantics • Object(物件):在循序圖中與傳遞傳訊有關的物件。 Object Name • 訊息傳遞(Message Flow)的種類: • Procedure call flow of control :當流程控制權交給下一個物件後,傳送端必需等待接受端傳回訊息,才可以繼續執行之後的活動。 • Asynchronous flow of control:當流程控制權交給下一個物件後,傳送端可以繼續執行活動,不需要等待接收端回應。 • Flat flow of procedure:當不須去描述message的詳細內容或不考慮物件的相關性時,則以Flat flow of procedure表示。 • Return from a procedure call:使用程序(Procedure)呼叫後,表示訊息回傳。有時可以省略。
[Z] X:Y( ) Notation and Semantics • 訊息(Message)的種類: • Label (標籤):X與Y表示訊息上的標籤。X以一個循序的號碼表示,代表時間上的順序。Y表示一個訊息的名稱,同時傳Y之參數。 • Condition (條件):Z表示條件限制。只有符合條件限制的情況,訊息才能進入下一個作用時間。 • Creation (建立):表示建立一個新的物件。 • Destroy(結束):表示物件的作用時間至此強迫結束。 <<create>> Object <<destroy>> X
object1 object2 [condiction1] Message1 [condiction2] Message2 Notation and Semantics Interaction diagram: Collaboration diagram (Modeling Flows of Control by Organization):描述為達成一個特定動作所有關連的Object,及Object互相合作的關係與訊息傳遞順序。 Sequence diagram (Modeling Flows of Control by Time):根據時間發生順序來表達物件間的互動及一連串時序上的訊息傳遞,起始觸發可以是由事件 (Event) 、行動者(Actor)、物件(Object)觸發。 c:Client 1:<<create>> 2:setAction(a,d,o) 3:<<destroy>> <<local>> <<global>> :Transaction p:ODBCProxy {transient} 2.1:setValues(d,3.4) 2.2:setValues(a,”CO”)
Example(Collaboration Diagram) :Phone :Sound Alarm Alarm :System Handler 2b:Trigger :Sound 2a:Trigger Alarm 2c.2:Trigger 2c:Alarm :Cell :Supervisor Handler 1:Alarm 2c.1:Store(Date,Time,Cell,Sensor) :Photo Cell :Log Sensor Active Object、Predecessor
Collaboration Diagram 2:clickAt(p) 2.2:putRecentPick(loc) c:Caller :Telephone :Exchange Procedural Sequence 2.1:loc=findAt(p) 1:liftHandset() 2:assertCall c:Caller :Telephone :Exchange Flat Sequence
Example(Collaboration Diagram) 5: kill checkers <<self>> 1: new [Valid] a Transaction a Transaction Coordinator 7: be Invalid 4: fail 3: new 6: kill 2: new a first Transaction Checker a second Transaction Checker
Example(Sequence Diagram) a Transaction 當一個Transaction產生之後….. a Transaction Coorinator 1: new …它會產生一個Coordinator來管理所有的檢查 a first Transaction Checker 2: new Coordinator會為每一種檢查產生一個Checker。這些Checker會各自進行自己的檢查 a second Transaction Checker 3: new 4: fail 如果某一個檢查失敗,Coordinator就會把其他還在執行的Checker刪除 5: kill checkers X 6: kill X ….並且告訴Transaction說檢查失敗 7: beInvalid X Object、Lifeline、Activation 、 Synchronous 、 Asynchronous 、 Return、Simple、Iteration、Label、Creation、Destroy
object p:ODBCProxy c:Client {transient} <<create>> :Transaction setActions(a,d,o) setValues(d,3.4) time setValues(a,”CO”) committed <<destroy>> X Example(Sequence Diagram)
activeObject: ActiveClass Notation and Semantics Collaboration diagram • Link (連結):連接兩物件的線。 • Active Object (主動物件):主動物件是擁有控制線(Thread)以及啟始控制動作(Control Operation)的物件。 1.1:getLastCheckpoint() 1:getPostionAtTime(t) t:AirTrafficPlanner p:FlightPlan
Notation and Semantics • Sequence diagram • Lifeline(生命線):表達物件存在互動過程中的生命。 • Focus of control(作用時間):表示Object在生命線中正在執行某項活動(Action)的作用時間。
object1 object2 [condiction1] Message1 [condiction2] Message2 object1 object2 b Message {b’-b<1 sec} b’ Notation and Semantics • Branching(分支):表示當在多種條件下,所可能產生的訊息。各種條件為互斥。 • Message with transaction time:表示message傳送的時間限制(由b到b‘) 。
Example(Sequence Diagram) Print(file) :Computer :PrinterServer :Printer :Queue [printer free] Print(file) Print(file) [printer busy] Store(file) Condition、Branching
Review(Collaboration Diagram) servers client :Server 1: aServer:=find(specs) aServer{local} :Server 2: process(request) Multiobject、Simple Message
Message Object Caller 1:OffHook 2:DialTone 3:DialNumber Exchange 4:RingTone Receiver 6:OnHook 5:OffHook Talk Telephone Call Review(Collaboration Diagram)
Review(Collaboration Diagram) NewCustomer() 1: [free memory]Create() :Main Window :Customer{new} 2: Create() 3: Show(Customer) 3.1 Update{data} :Customer Window Creation of Object、 Synchronous
Review(Collaboration Diagram) c:Client 1:<<create>> 2:setAction(a,d,o) 3:<<destroy>> <<local>> <<global>> :Transaction p:ODBCProxy {transient} 2.1:setValues(d,3.4) 2.2:setValues(a,”CO”)
Review(Collaboration Diagram) 2:addStudent(s) r:RegistrarAgent :School 1:<<create>> 2:register() 3.1:getSchedule <<local>> s:Student s:Student Registered = False Registered = True 3.4:<<become>> 3.2:add(s) 3.3:add(s) c1:Course c2:Course {association} {association}
Review(Sequence Diagram) c:Client p:PlanningAssistant <<create>> :TicketAgent Setltinerary(i) calculateRoute() route <<destroy>> X notify() Messages
Review(Sequence Diagram) c:Client :Switch R:Caller lifeReceiver {dialing.executionTime < 30 sec} setDialTone() dialDigit(d) routeCall(s,n) <<create>> c:Conversation Ring() lifeReceiver Connect(r) Connect(r,s) Connect(s) Callers s and r may exchange information after both are connected
Key Terms Advance • Interaction diagram • Collaboration diagram • Path stereotypes • Self • Global • local • parameter • Sequence diagram