Introduction to Java Programming-Comprehensive Version (6th Edition)

 

[Page 390 ( continued )]

11.7. (Optional) Modeling Dynamic Behavior Using Sequence Diagrams and Statecharts

The UML diagrams presented so far describe the properties and methods of a class or the static relationships among classes. This section introduces the sequence diagrams and statechart diagrams that model the dynamic behaviors of objects.

11.7.1. Sequence Diagrams

Sequence diagrams describe interactions among objects by depicting the time-ordering of method invocations. A sequence diagram consists of the following elements, as shown in Figure 11.14:

Figure 11.14. Sequence diagrams describe interactions between objects.

(This item is displayed on page 390 in the print version)

The interactions among the objects in the BorrowLoan class on page in Listing 11.5 are illustrated in Figure 11.15.

Figure 11.15. The BorrowLoan object invokes the methods in the Name , Address , Loan , and Borrower objects.

11.7.2. Statechart Diagrams

Statechart diagrams describe the flow of control of an object. A statechart diagram contains the following elements, as shown in Figure 11.16:

Figure 11.16. Statechart diagrams describe the flow of control of an object.


[Page 392]

The life cycle of an object can be illustrated using a statechart diagram, as shown in Figure 11.17.

Figure 11.17. The life cycle of an object can be described using a statechart diagram.

 

Категории