Figure profile
Granville Miller (rmiller@togethersoft.com) consultant, togethersoft 2001 May
Granville Miller introduces a component of "Unified Modeling Language" (UML) in its new column: Sequence diagram. A sequence diagram is used throughout the design, which is used to present internal interactions between the participant and the object when executed. Let's create one of the pictures with Granville, we will use a loan processing application as an example.
Unified Modeling Language (UML) is a standard marker method for establishing an object-oriented system model. Between 1995 and 1997, UML mounted the stage for object-oriented programming communities, and was recognized by the Object Management (OMG) in 1997. Although it is initially controversial - because it is in a support and opposition - but UML has become industry standards for system marking. The current version of UML is 1.4, and it will continue to develop to meet the needs of object-oriented developers. (For more information on UML history, see Resources.)
UML may be difficult to learn, mainly because it is trying to provide a model mark method for considerable extensive situation. Each modeling mark is used in a picture, and there is currently nine diagrams in the UML specification. Fortunately, learning UML can be a progressive process; you can only learn one picture each time, you don't have to include a very complicated thing in the figure for the first time.
In this column, I will teach you to gradually learn the UML design and markings based on Java applications. I will introduce the basics of the UML framework and other modeling techniques in a logical (may be another people), and you will learn the actual operation by building a model of the real example. In the first part, we start using the loan processing application as an example, starting from the establishment sequence diagram. Note that you are familiar with Java language and master the basics of object-oriented methods and terms. This column will briefly explain the object-oriented concept, but will not perform in-depth discussion.
About sequence diagram
About participant role participant roles help discover and identify participants in the use case scheme. A participant can have multiple roles in one use case and multiple use cases. Currently, four different participant characters have been identified into UML-enhanced or traditional roles: launches, servers, receivers, and proxy. Because the participant role can be reflected in the sequence diagram, you should be familiar with their functions.
The starter is an external entity that sets a system behavior in the action. The startup program can request a service or generate an event. In the sequence diagram showing the participant, the starter starts the sequence in the action. The external server role provides services for other roles. The server helps the system to achieve its goals by providing functionality or information outside. Many external systems that contain operating systems are server roles. The server will receive messages, but may not generate messages. The recipient role receives information from the system. They provide services in a negative way. Therefore, they may not provide values to the system, but they want other participants to provide values. An example of the recipient is a data warehouse or an external backup system. The recipient typically receives messages from objects in the system, but generally do not generate messages. The agent is a participant that represents another participant's execution operation. One example of the agent is the audio-visual staff who represents the customer's rental video.
UML did not exclude any special software development methods or processes; it only standardized the format of the marker method. However, many development methods have merged UML. The Rational Uniform Process (RUP) is a method; another method is the development (FDD) of functionally driven. Due to their intuitiveness and versatility, the UML sequence diagram has become part of the front-end modeling activity of these processes. The sequence diagram is used to establish the model of the following:
Protocol subsystem class method logic in the use case frame
The following is a brief description of each of the above functions.
Use an example scenario to the sample application, we will use a sequence diagram to create a model of a single use case. The use case is a single task that interacts with the application to implement a specified target to implement a specified target. Participants can interact with the application, any end user, organization, or system outside the application. (To learn more about the role of participant; see the participant role; if you need to discuss the in-depth discussion of the use case scheme, see the reference material.) The protocol protocol in the framework is located between the frame and it is called the exchangeable component called the assembly. . Understanding the interaction of the framework helps to develop new aggregates. Sequence diagrams are typically used to record these interactions.
Subsystem large projects are broken down into a smaller and easy management part, called a subsystem. The interface between subsystems is critical to integrating them into greater (ie, systems). The sequence diagram is used to specify the interaction between classes on the subsystem boundary.
Certain classes such as socket and inetaddress require a complex method to call the sequence in order to correctly interact. These sequences constitute an agreement for interacting with such a class or a set of classes. The sequence diagram can be used to describe the use of classes or groups of interactions, thereby describing the protocol required for interaction.
Method logic sequence diagrams are very good in logic logic. In fact, as long as the Java method is given, some CASE tools automatically generate a sequence diagram. The sequence diagram can be used to design a process of future methods or recording existing methods.
About the sample application We will learn a sequence diagram with the help of the sample loan processing application. Because this column is focused on modeling, not the method, we have to discuss the establishment map directly, so we will not focus on the details of the application. Our basic functions draw for loan processing applications are as follows:
Use: Submit loan request
The applicant is completed through the Internet and submits a loan application to the bank. The system confirms the information of the loan application, check whether it is correct and whether the information is as complete as possible. The system forwards loan requests to the external business credit advisory organization to obtain the applicant's credit report. The system calculates the applicant's credit score based on the returned credit report.
The first step in the entry creation sequence diagram is to determine if the figure represents interaction with an external or internal entity. If the model of the use case scheme is being established, then the sequence diagram usually represents interaction with the external entity. If the model of the protocol in the framework is being established, this figure may indicate internal or external interactions. Subsystem diagrams, class diagrams, and individual method logic diagrams typically only represent internal entities. No matter which case, the interaction type to be modeled determines the first (leftmost) element in the sequence diagram.
Interaction with external entities means participants are part of interaction. Internal interaction may be started by the participant (if the subsystem use case is the foundation of the interaction), but it is more likely to be started by a common class called Sender. If the participant launches interaction, the participant will return to the launcher category, which is one of the four common participant characters (for more information, see About participant roles).
We will focus on the scheme for loan processing applications (the above-over the submission loan request usage example). Please note that when the applicant completes the online loan application and submits changes in the timing chart on the Internet. In this scenario, the applicant is outside the system, so he uses participants to express him. We first add participant Applicant to a sequence diagram, as shown in Figure 1.
Figure 1. Add applicant
Adding a participant once the initiator is in place, the next step is to add an object that is interacting with it in the process of the program. The names of these objects should reflect the behavior of class or instance. (The choice of class or instance gives a very different meaning with the sequence diagram, but I will reserve the difference between the two to the next discussion.)
For sample scenarios, we will add two classes: LoanApplication and LoanRequest. When applying for a loan, you need to submit a loan application. It contains information about applicants and expected loans. The loan request is a form that is sent to the commercial credit advisory authority on receiving the loan application. It contains some information from the loan application, and obtains requests for the applicant's credit history information. Figure 2 shows the addition of these two classes to the sequence diagram. Figure 2. Add two interactions
Connect to each point - Dotted lines for most software developers, the sequence diagram is intuitive. They map objects and participants (horizontal axes) to time (vertical axis). The message is connected to the object when the message occurs, moves along the longitudinal axis from an object to another. These messages are connected to the vertical dashed line extending from the middle of the object or the bottom of the participant. This line is called a lifeline.
On the horizontal axis, we use the arrows called the arrow or message arrow to indicate the message. Message arrow points from the sender (tail) to the receiver (head). These arrows are used to capture the dynamic behavior of the system. The call usually begins with the left and moves to the right. That is, the initial arrow in the interaction is usually from the left. When the new instance of the class is created, the arrows we draw are directed to the class, not the lifeline. The first step in our program is to create a new loan application, so we draw an arrow between Applicant and LoanApplication. Since the new instance is created with Java involves the calling constructor, we labeled this arrow to the constructor name, maybe, it is also possible to mark the variable.
We are still in the analysis phase of the software development lifecycle, so we must only include analysis information. One of our business analysts mentioned that we refer to the operation of creating a new loan application as "complete loan application". If we want to keep this sequence diagram in the construction process, you can implement the Complete into a public method, which will call the LoanApplication constructor, as shown in Figure 3.
Figure 3. Creating LoanApplication
Establish a map of a activity but when the class or instance receives a message, it creates a box on the lifeline of the received object; this box is called active. The activity represents the control of the control power in the method of the recipient. When the message causes an object to create an object, the first activity represents the logic of the constructor. Subsequent messages will result in create new activities.
However, when the message is received, the receiving object can sequentially send a message to its own or other object. This is displayed by the tail of the arrow, which indicates that the arrow originates from the activity and terminates from new activities. But when the object calls itself, the new activity will put on the old activity.
In this scenario, the applicant is applied for interaction with the loan, and the first time it is completed, and the second time is submitted. When LoanApplication receives the Submit message, it will verify itself by sending the Validate message to itself. If it is valid, it will create a new LoanRequest to be sent to the commercial information consulting body. Figure 4 shows the verification process of the LoanApplication.
Figure 4. Confirm that LoanApplication
Arrow file: Indicates that time lapse us uses an oblique arrow to indicate the lapse of the real time between messages and reception. This marker method is used to display non-basic calls. An example of a non-basic call is called via a method that is performed by CORBA or RMI, or a message sent on the network.
In this example, the business credit advisory body is an external system that is a participant with server roles (see About Participant Role). Servers typically do not generate messages, but there is a message sent to them - in this example is a request for credit reports sent by the credit inspector. The credit inspector represents a commercial information consulting agency. It tracks the request and forwards the request to the commercial credit advisory body, tracks and receives a response, and is also the connection between the loan processing application and the commercial information consulting authority. The business credit advisory body will receive a request and processed the request according to its own timetable. We use the oblique arrow to indicate the passage of this time, as shown in Figure 5 below. At the end of the event, the result of returning to the calling program is implicit. However, in some cases, you may want to return to be explicit. Explicit returning call is represented by a dotted arrow that the tail of the arrow is the receiver and the head is the sender. Explicit returns arrows are typically marked by the value returned. For this example, we have added explicit arrows between CreditBureau and CreditChecker. This arrow can be tagged CreditReport because it is an object returned from the RequestCreditReport method.
Figure 5. Get CreditReport
Next I have mentioned in this article, the sequence diagram is used to describe internal behavior at the system runtime. In this article, I have introduced the first step in building a sequence diagram by building a model interacting between objects. In the next section, I will introduce two sequence diagrams (regular and instances) and use the example description of the conditional logic in the sequence diagram in the role of the sequence diagram using an example of the simple Java method. see you then!
Reference
Click on "Discussion" at the top of this article to participate in the discussion forum on this article. Martin Fowler (Author) of UML DISTILED provides an insider of UML early history. Fowler's "Why use UML" further illustrates the need to standardized tag method in the development cycle (Software Development Online, March 2000). If you want to learn UML carefully, you should start from three friends (Booch, Jacobson, Rumbaugh): Unified Modeling Language User Guide (Addison Wesley Object Technology Series, 1998). The basic reading that should be learned is the unified modeling language specification of OMG (version of February 2001 is version 1.4). The Rational's UML resource page provides information about UML, RUP and other content. For additional information about the sequence diagrams and UML, see "Building a UML Sequence Diagram with Style, by Scott W. Ambler (DeveloperWorks, February 2001). Allen Holub provides an in-depth explanation of the use case solution in his series of object-oriented design processes (United States, January 2001). If you want to study more deeply, see Frank Armour and Granville Miller - Advanced Use Case Modeling, Volume I: Software Systems (Addison-Wesley, 2001). For information on functional drive development and excellent reading of the Rational Unified Process, see Peter COAD, ERIC Lefebvre, Jeff Deluca - Java Modeling in Color With UML (Prentice Hall, 1999). Another good book on RUP is the Rational Unified Process: An Introduction (Addison Wesley, 2000) written by Philippe Kruchten. Please read the OCL, it is the UML expression language. IBM and other industry leaders have created XMI, a new open industry standard, which combines some of the advantages of XML standards such as web-based, confirming, and shared document formats, and UML. About author
Granville has been added to the object-oriented community for 13 years. He is the Advanced Use Case Modeling family, and the tutorials in the world-oriented technical conferences worldwide. His object-oriented development practical approach comes from his experience in providing a number of companies in many companies, including various companies from companies in the entrepreneurship stage to a quite mature software industry.