Документ взят из кэша поисковой машины. Адрес оригинального документа : http://sp.cs.msu.ru/courses/prak5/exercise.pdf
Дата изменения: Fri Sep 3 16:14:02 2004
Дата индексирования: Mon Oct 1 21:39:12 2012
Кодировка:
(Wendy Boggs) (Michael Boggs)

UML Rational Rose




2


1. ............................................................................................. 3 ................................................................................................................................................................... 3 ................................................................................................................. 3 ............................................................................................................................................. 3 2. ............................................................................................................... 5 ................................................................................................................................................................... 5 ..................................................................................................................................... 5 ............................................................................................................................................. 5 3. ........................................................................................................................... 12 ................................................................................................................................................................. 13 .............................................................................................................................................. 13 ........................................................................................................................................... 13 4. ( ) ................................................................................ 15 ................................................................................................................................................................. 15 ....................................................................................................................................... 16 ........................................................................................................................................... 16 5. ( ) ............................................................ 18 ................................................................................................................................................................. 18 ................................................................................................................................................................. 18 ........................................................................................................................................... 18 6. .................................................................................................................... 19 ................................................................................................................................................................. 19 .......................................................................................................................................... 19 ........................................................................................................................................... 20 7. ................................................................................................................ 21 ................................................................................................................................................................. 22 ........................................................................................................................................... 24 8. ................................................................................................................. 26 ................................................................................................................................................................. 26 ....................................................................................................................................... 26 ........................................................................................................................................... 26 9. C++ ........................................................................................................................................ 27 ........................................................................................................................................... 27 10. Java- ...................................................................................................................................... 28 ........................................................................................................................................... 29 11. IDL- ...................................................................................................................................... 30 ........................................................................................................................................... 30


3

1.
"!" - , . , : " ?" " , . , ." "", -- - " . , . . , , , ." Robertson's Cabinets, Inc. - , . . , , . . , 50 . - , , . , . -- , , . . " , . ." "." " Java, ?" " . , ?" ", ." " ? ". ", , . , . . ". " , ?" "". , , , , . , . , . , . . . 1.
,

1. (Main) , . 2. Use Case ( ) . 3. " ". 4. 2 3, : , , , , 5. Actor ( ) . 6. ""


4

7. 5 6, : , ,





<>











. 1. .


1. " " . 2. Open Specification ( ). 3. Abstract (), .


1. Unidirectional Association ( ) " ". 2. , .


1. Generalization " " " ". . , " " " ". 2. " " " ". 3. Open Specification ( ). 4. extends (), . 5. <> .


1. 2. 3.

" ". : . .


5

1. 2. : - , . 3. .


1. " " OrderFlow.doc, : 1. " " . 2. " ". 3. , , . 4. . 5. . 2. " ". 3. Open Specification ( ) 4. . 5. Insert File ( ). 6. OpenFlow.doc Open (), .

2.
, . , , , Robertson's Cabinets. . , . . " ", . . , . , . , . : 1. . 2. , . 3. , . " ". , . 5. , " ". . , , , , . .


1. Tools > Options ( > ). 2. .


6

3. Sequence Numbering, Collaboration Numbering Focus of Control . 4. , .


1. 2. 3. 4. 1. 2. 3. 4. 5. # # 1. 2. 3. 4.

. New > Sequence Diagram. " ". , . (Salesperson) . Object (). , . "Order Options Form -- ". 3 4, : "Order Detail Form" -- "Order N1234" -- 1234.





Object Message ( ). . , "Create New Order" -- . 2 3, : # Open form -- ( ) # Enter order number, customer, order items -- , ( ) # Save the order -- ( ) # Create new, blank order -- ( 1234) # Set the order number, customer, order items -- , ( 1234). # Save the order -- ( 1234) . 2.



1: 2:



1234

3: ,

4:

5:

6: ,

7:

. 2. .


7

. , , . , . , .


1. 2. 3. 4. 5. 6.

Object. 1234, . - Order Manager ( ). Object. 1234. - Transaction Manager ( ).



1. 5 ( ). 2. CTRL + D, . 3. 1 2, : # , # 4. Object Message. 5. , 4 . 6. Save the order ( ).


1: 2:





1234



3: ,

4: 5: 6:

7: ,

8:

9:

10:

. 3. . 7. 4 - 6, : # Create new, blank order ( ) - 1234. # Set the order number, customer, order items ( , ) - 1234.


8

# Save the order ( ) - . # Collect order information ( ) - 1234. 8. Message to Self ( ). 9. 9, . Save the order information to the database ( ). 3.


1. . 2. Open Specification ( ). 3. (). . 4. OrderOptions ( ). 5. . . 6. OrderOptions. 7. , . Order Options Form : OrderOptions ( : OrderOptions). 8. 1 7: # OrderDetail . # OrderMgr - . # Order - 1234. # TransactionMgr - . 4.

:
1: 2:

:

:

1234:

:

3: ,

4: 5: 6:

7: ,

8:

9:

10:

. 4. .


1. 1, .


9

2. ( ). . 3. - Create (). 4. , . 5. 1. 6. Create(). 7. 1 6, : # 2: Open() # 3: , - SubmitInfo(). # 4: - Save(). # 5: - SaveOrder(). # 6: - Create(). # 7: , - SetInfo(). # 8: - SaveOrder(). # 9: - GetInfo(). # 10: - Commit. 5.

:
1: Create() 2: Open()

:

:

1234:

:

3: SubmitInfo()

4: Save() 5: SaveOrder() 6: Create()

7: SetInfo()

8: SaveOrder()

9: GetInfo()

10: Commit()

. 5. .


F5 , , . 1. . 2. New > Collaboration Diagram. 3. . 4. , .


10

1. 2. 3. 4. 5.

(Salesperson) . Object (). - , . "Order Options Form" -- . 3 4, : # "Order Detail Form" -- # "Order N1234" -- 1234.



1. Object Link ( ). 2. . 3. 1 2, : # . # . # 1234. 4. Link Message ( ). 5. . 6. , "Create New Order -- ". 7. 4 6, , : # Open form -- ( ) # Enter order number, customer, order items -- , ( ) # Save the order -- ( ) # Create new, blank order -- ( 1234) # Set the order number, customer, order items -- , ( 1234). # Save the order -- ( 1234) , , , .


1. 2. 3. 4. 5. 6. 1. 2. 3.

Object. - , . - Order Manager ( ). Object. . - Transaction Manager ( ).



5 ( ). , . CTRL + D, . 1 2, 6 7: # , # 4. 1234. 5. CTRL + D, . 6. Object Link ( ). 7. . 8. Object Link ( ). 9. 1234. 10. Object Link ( ). 11. 1234 . 12. Object Link ( ). 13. . 14. Link Message ( ). 15. , . 16. Save the order ( ). 17. 14 - 16, :


11

18. 19. 20. 21. 22.

# Create new, blank order ( ) - 1234. # Set the order number, customer, order items ( , ) - 1234. # Save the order ( ) - . # Collect order information ( ) - 1234. Message to Self ( ). , . Link Message ( ). , . Save the order information to the database ( ).

( )

1. OrderOptions. 2. . 3. 1 2, : # OrderDetail . # OrderMgr - . # Order - 1234. # TransactionMgr - .
( )

1. . 2. Open Specification ( ). 3. (). . 4. OrderOptions ( ). 5. . . 6. OrderOptions. 7. , . Order Options Form : OrderOptions ( : OrderOptions). 8. 1 7: # OrderDetail . # OrderMgr - . # Order - 1234. # TransactionMgr - .
( )

1. 2. 3. 4. 5.

1, . Open Specification ( ). - Create (). . : # 2: Open() # 3: , - SubmitInfo(). # 4: - Save(). # 5: - SaveOrder(). # 6: - Create(). # 7: , - SetInfo(). # 8: - SaveOrder(). # 9: - GetInfo(). # 10: - Commit().

( )

1. 1, .


12

2. ( ). . 3. - Create (). 4. , . 5. 1. 6. Open Specification ( ). 7. Name () . 8. . 9. , : # 2: Open() # 3: , - SubmitInfo(). # 4: - Save(). # 5: - SaveOrder(). # 6: - Create(). # 7: , - SetInfo(). # 8: - SaveOrder(). # 9: - GetInfo(). # 10: - Commit. 6.

. 6. .

3.
, . , .


13

, , . : " , ". ". ". Rose. . Entities (), Boundaries () Control (), . ; , -- . . , " ".


1. Tools > Options ( > ). 2. . 3. , Show Stereotypes ( ). 4. , Show All Attributes ( ) Show All Operations ( ). 5. , Suppress Attributes ( ) Suppress Operations ( ).


1. 2. 3. 4.

. New > Package ( > ). Entities (). , Boundaries () Control ().







. 7. .


1. , . 2. Entities . 3. Boundaries Control . 7.
" " .

1. .


14

2. 3. 4. 5.

New > Class Diagram ( > ). Add New Order ( ). , . (OrderOptions, OrderDetail, Order, OrderMgr TransactionMgr). 8.


Create()

SaveOrder()





Open() SubmitInfo() Save()

SaveOrder() Commit()



reate() SetInfo() GetInfo()

. 8. Add New Order.


1. 2. 3. 4. 5. 6. 7. 8. 9.

OrderOptions . Open Specification ( ). Boundary. . OrderDetail . Open Specification ( ). Boundary. . . 1 - 4, OrderMgr TransactionMgr Control, Order Entity. 9.



1. 2. 3. 4. 1. 2. 3. 4. 5. 6. 7.



OrderOptions Boundaries. OrderDetail Boundaries. OrderMgr TransactionMgr Control. Order Entities.



Boundaries . New > Class Diagram ( > ). - Main (). , . OrderOptions OrderDetail. . Entities .


15

8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19.

New > Class Diagram ( > ). - Main (). , . Order. . Control . New > Class Diagram ( > ). - Main (). , . OrderMgr TransactionMgr. .
<<>>
Create()

<<>>
SaveOrder()

<<>>
Open() SubmitInfo() Save()

<<>>
SaveOrder() Commit()

<<>>
reate() SetInfo() GetInfo()

. 9. .

4. ( )
2 . . , . , . , " ", . ++, , . . , Order Order Number ( ) Customer Name ( ). . , , , Order. , , 10.


16


:
1: Create() 2: Open() 3: SubmitInfo() 4: Save() 5: SaveOrder() 6: Create() 7: SetInfo() 8: Create() 9: SetInfo() 10: SaveOrder() 11: GetInfo()

:

:

1234:

:

:

12: GetInfo() 13: Commit()

. 10. . : " . , , ." " ". " ", , . " " , . , , " ", " ". , , Order. . " ". . , , . UML.


1. 2. 3. 4. 5. 6. 7. 8.

Tools > Options. Diagram. , Show Visibility . , Show Stereotypes . , Show Operation Signatures . , Show All Attributes Show All Operations . , Suppress Attributes Suppress Operations . Notation.


17

9. , Visibility as Icons .


1. 2. 3. 4. 5. 6. 7.

" ". , . Class . , . OrderItem (). Entity. Entities.



1. Order (). 2. New Attribute ( ). 3. OrderNumber : Integer () 4. Enter. 5. CustomerName : String (). 6. 4 5, OrderDate : Date () OrderFillDate : Date (). 7. OrderItem. 8. New Attribute ( ). 9. ItemID : Integer (). 10. Enter. 11. ItemDescription : String ().
OrderItem

1. 2. 3. 4. 5. 6. 7. 1. 2. 3. 4. In 5.

OrderItem. New Operation ( ). Create. Enter. SetInfo Enter. GetInfo. Order, . , . Create(), : Create() : Boolean SetInfo(), : SetInfo(OrderNum : teger, Customer : String, OrderDate : Date, FillDate : Date) : Boolean GetInfo(), : GetInfo() : String





1. OrderItem. 2. , "+" . . 3. GetIInfo(), . 4. Return class ( ) String. 5. , . 6. SetInfo OrderItem, . 7. Return class Boolean. 8. Detail (). 9. , . 10. Insert. Rose argname. 11. , , ID. 12. Type, . Integer. 13. Default, . 0. 14. , . 15. Create() OrderItem, . 16. Return class Boolean.


18

17. , .


1. , Open() : Boolean SubmitInfo() : Boolean Save() : Boolean 2. , OrderOptions: Create() : Boolean 3. , SaveOrder(OrderID : Integer) : Boolean 4. , TransactionMgr: SaveOrder(OrderID : Integer) : Boolean Commit() : Integer

OrderDetail:

OrderMgr:

5. ( )
, " ". . , , . , . . . , " ".


1. " " 2. , . 3. , Unidirectional Association. , , 4 5. , . 4. Customize. 5. , Create A Unidirectional Association.


1. Unidirectional Association. 2. (OrderOptions) (OrderDetail). 3. 1 2, : # OrderDetail (OrderMgr) # OrderMgr (Order) # OrderMgr (TransactionMgr) # TransactionMgr Order # TransactionMgr (OrderItem) # Order OrderItem 4. OrderOptions OrderDetail, OrderOptions. 5. Multiplicity > Zero or One. 6. . 7. Multiplicity > Zero or One. 8. 4 - 7, , 11.


19

<<>>
Create() 0..1 0..1

<<>>
0..1 SaveOrder() 1 0..1

0..1

<<>>
Open() SubmitInfo() Save()

0..1

<<>>
0..1 0..* SaveOrder() Commit() 0..1

<<>>
OrderNumber: Integer CustomerName: String OrderDate: Date OrderFillDate: Date reate(): Boolean SetInfo(): Boolean GetInfo(): String 1 0..*

1..*

0..*

<<>>
ItemId: Integer ItemDescription: String reate() SetInfo() GetInfo()

. 11. " ".

6.
Order. Order, , . . , , , , , , , , . , , Order. , . Order, 12.


20
H

[ ]


entry: do: do:







[ ]


exit:


do:

H

. 12. Order.


1. Order. 2. Open State Diagram.


1. 2. 3. 4.





Start State ( ). . End State ( ). .



1. State (). 2. .


1. 2. 3. 4. 5. 6. 7. 8. 9. 10.

State (). . Cancelled (). State (). . Filled (). State (). . Initialization (). State ().


21

11. . 12. Pending ( ).


1. 2. 3. 4. 5. 6. 7. 8. 9. 10. On 11. 12. 13. 14. 1. 2. 3. 4.

Initialization (). Actions (). Insert (). . Store Order Date ( ). , When () On Entry ( ). 3 - 7, : # Collect Customer Info ( ), When Do # Add Order Items ( ), When Do , . Cancelled (). 2 - 7, Store Cancellation Data ( ), Exit ( ) , . Filled (). 2 - 7, Bill Customer ( ), Do. , .



Transition (). . Initialization (). , : # Initialization () Pending ( ) # Pending ( ) Filled () # Cancelled () # Cancelled () # Filled () 5. Transition to Self ( ). 6. Pending ( ).


1. Initialization () Pending ( ), . 2. Event () Finalize order ( ). 3. , . 4. , Cancel Order ( ) Cancelled (). 5. Pending ( ) Filled (), . 6. Event () Add Order Item ( ). 7. Detail (). 8. Condition () No unfilled items remaining ( ). 9. , . 10. (Transition to Self) Pending ( ). 11. Event () Add Order Item ( ). 12. Detail (). 13. Condition () Unfilled items remaining ( ). 14. , .

7.
. , " ". .


22

, . ++, . 13 . .

. 13. .

. 14. Entities. 14 Entities. Entities . 15 Control. Control .


23

. 15. Control. , 16 Boundaries. . 17 . . .

. 16. Boundaries.


24

. 17. .


1. 2. 3. 4.

. New > Package ( > ). Entities (). , Boundaries () Control ().



1. , . 2. Entities, Boundary Control .


1. 2. 3. 4.



Dependency (). Boundaries . Control. 1 - 3, Control Entities.



1. Entities , . 2. Package Specification ( ). 3. . 4. OrderItem. 5. 2 - 4, Order. 6. Package Body ( ). 7. . 8. OrderItem. 9. 6 - 8, Order. 10. Dependency (). 11. OrderItem. 12. OrderItem.


25

13. 10 - 12, Order Order. 14. 10 - 12, Order OrderItem. 15. : Boundaries: # OrderOptions # OrderOptions # OrderDetail # OrderDetail Boundaries: # OrderOptions OrderOptions # OrderDetail OrderDetail # OrderOptions OrderDetail Control: # OrderMgr # OrderMgr # TransactionMgr # TransactionMgr Control: # OrderMgr OrderMgr # TransactionMgr TransactionMgr # OrderMgr TransactionMgr


1. 2. 3. 4. 1. 2. 3. 4. 5. 6. 7. 8.

. New > Component Diagram System. . , Entities, . Order Entities. . 2 3, OrderItem. : Boundaries: # OrderOptions # OrderDetail Control: # OrderMgr # TransactionMgr Task Specification ( ). OrderClientExe. 6 7 OrderServerExe.





. . 1. Dependency (). 2. OrderDetail. 3. OrderMgr. 4. 1 - 3, : # OrderMgr Order # TransactionMgr OrderItem # TransactionMgr Order # OrderClientExe OrderOptions # OrderServerExe OrderMgr


26

1. Order Entities. 2. Order . Order Order. 3. Order Order . Order Order. 4. 1 - 3, : # OrderItem OrderItem # OrderItem OrderItem # OrderOptions OrderOptions # OrderOptions OrderOptions # OrderDetail OrderDetail # OrderDetail OrderDetail # OrderMgr OrderMgr # OrderMgr OrderMgr # TransactionMgr TransactionMgr # TransactionMgr TransactionMgr

8.
. . , . , , . . . 18.


1. , . 2. Processor (). 3. , . 4. " ". 5. 2 - 4, : # # 1 # 2 6. Device (). 7. , . 8. "".


1. 2. 3. 4.

Connection (). " ". " ". 1 - 3, : # " " " 1" # " " " 2" # " " ""


27



OrderServerExe





1 OrderClientExe

2 ATMClientExe

. 18. .


1. 2. 3. 4.

" " . New > Process ( > ). OrderServerExe. 1 - 3, : # " 1" -- OrderClientExe # " 2" -- ATMClientEXE



1. " ". 2. Show Processes ( ). 3. 1 2, : # 1 # 2.

9. C++
(Order Entry). C++ . , 19. .


1. 2. 3. 4.

. Entities: Order. "" Order . . 2 3 : Entities: OrderItem. Boundaries: OrderOptions. Boundaries: OrderDetail. Control: TransactionMgr. Control: OrderMgr.


28

. 19. Order Entry
C++

1. Order ( ) Entities. 2. C++. 3. . 1 2 : Entities: Order. Entities: OrderItem. Entities: OrderItem. Boundaries: OrderOptions. Boundaries: OrderOptions. Boundaries: OrderDetail. Boundaries: OrderDetail. Control: TransactionMgr. Control: TransactionMgr. Control: OrderMgr. Control: OrderMgr. OrderClientExe. OrderServerExe.
C++

1. . 2. . 3. Tools > C++ > Code Generation .

10. Java-
(Order Entry). Java . , 20.


29

. 20. Order Entry .


1. 7 . Java , . 2. . 3. OrderOptions. 4. Ctrl+D, . 5. . 3 4 : T OrderDetail. OrderMgr. Order. OrderItem. TransactionMgr.
Java

9. , ++ Java.
Java

1. Java Java. Data Types . 2. File > Import . Data Types\Java 3. . 4. File > Import . Data Types\Java

-. Classes.ptl -. Components.ptl -.


30 Java

1. - , Java , C++, , . : , Date java.util.Date. 2. Add Order Class. 3. , , 21.

. 21. Java Order Entry
Java

1. 2. 3.

. . Tools > Java > Generate Java . Java , -.

11. IDL-
IDL (Order Entry): Order, OrderItem, TransactionMgr OrderMgr. IDL . -.
CORBA

1. Add Order Class. 2. Order. 3. Order interface.


. .


31

1. 7 , C++. CORBA. -- , . 2. . 3. Ctrl+D, . 4. Component : Order, OrderItem, TransactionMgr OrderMgr. 5. Order. 6. CORBA. 7. "" Order Order . 8. . 5-7, OrderItem, TransactionMgr OrderMgr CORBA.
CORBA

1. OrderNumber Order. 2. "..." Type . 3. + CORBA Types . 4. Long . 5. . 1-4 Order, OrderItem, OrderMgr TransactionMgr, CORBA. 6. SetInfo Order. 7. "..." Return . 8. + CORBA Types . 9. boolean . 10. Integer OrderNum . 11. + CORBA Types long . 12. . 6-11 Order, OrderItem, OrderMgr TransactionMgr.
CORBA/IDL

1. Add Order Class. 2. Order, OrderItem, TransactionMgr OrderMgr. 3. Tools > CORBA > Generate CORBA. , . -.