Methods and the UML Sequence Diagram

   

Methods and the UML Sequence Diagram

The UML overview in Chapter 1, "Object-Oriented Programming," introduced the practice of using sequence diagrams to depict method calls between objects, which can be thought of as message passing. Figure 4.1 shows a sequence diagram for a simplified scenario for withdrawing a sum of money from a bank account. Here, the actor in the system sends a message to the AccountController that then interacts with an Account and an AccountTransaction to satisfy the request.

Figure 4.1. A sequence diagram depicts method calls between objects.

graphics/04fig01.gif

In a formal design process, using an approach like this is precisely how the set of methods you need to implement for a class gets defined. If you know that a system must support a withdrawal operation, you can focus on the classes that will be involved and the required interaction between their instances. This allows you to discover the methods that are needed and eventually specify their exact signatures. From a design standpoint, the functionality introduced in this chapter relating to return types and parameter lists is the most important. After you move into implementation on the basis of the methods discovered in your sequence diagrams, other factors such as the access specifiers and modifiers associated with your methods become significant.

   


Special Edition Using Java 2 Standard Edition
Special Edition Using Java 2, Standard Edition (Special Edition Using...)
ISBN: 0789724685
EAN: 2147483647
Year: 1999
Pages: 353

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net