1、外文翻译UML 20 序列图组合碎片中文2270字UML2.0 Sequence Diagram Combined fragmentsThe diagrams purposeThe sequence diagram is used primarily to show the interactions between objects in the sequential order that those interactions occur. Much like the class diagram, developers typically think sequence diagrams were
2、 meant exclusively for them. However, an organizations business staff can find sequence diagrams useful to communicate how the business currently works by showing how various business objects interact. Besides documenting an organizations current affairs, a business-level sequence diagram can be use
3、d as a requirements document to communicate requirements for a future system implementation. During the requirements phase of a project, analysts can take use cases to the next level by providing a more formal level of refinement. When that occurs, use cases are often refined into one or more sequen
4、ce diagrams.An organizations technical staff can find sequence diagrams useful in documenting how a future system should behave. During the design phase, architects and developers can use the diagram to force out the systems object interactions, thus fleshing out overall system design. One of the pr
5、imary uses of sequence diagrams is in the transition from requirements expressed as use cases to the next and more formal level of refinement. Use cases are often refined into one or more sequence diagrams. In addition to their use in designing new systems, sequence diagrams can be used to document
6、how objects in an existing (call it legacy) system currently interact. This documentation is very useful when transitioning a system to another person or organization. The notation Since this is the first article in my UML diagram series that is based on UML 2, we need to first discuss an addition t
7、o the notation in UML 2 diagrams, namely a notation element called a frame. The frame element is used as a basis for many other diagram elements in UML 2, but the first place most people will encounter a frame element is as the graphical boundary of a diagram. A frame element provides a consistent p
8、lace for a diagrams label, while providing a graphical boundary for the diagram. The frame element is optional in UML diagrams; as you can see in Figures 1 and 2, the diagrams label is placed in the top left corner in what Ill call the frames namebox, a sort of dog-eared rectangle, and the actual UM
9、L diagram is defined within the body of the larger enclosing rectangle.In most sequence diagrams, however, the UML 1.x in-line guard is not sufficient to handle the logic required for a sequence being modeled. This lack of functionality was a problem in UML 1.x. UML 2 has addressed this problem by r
10、emoving the in-line guard and adding a notation element called a Combined Fragment. A combined fragment is used to group sets of messages together to show conditional flow in a sequence diagram. The UML 2 specification identifies 11 interaction types for combined fragments. AlternativesAlternatives
11、are used to designate a mutually exclusive choice between two or more message sequences. 3 Alternatives allow the modeling of the classic if then else logic (e.g., if I buy three items, then I get 20% off my purchase; else I get 10% off my purchase).As you will notice in Figure 8, an alternative com
12、bination fragment element is drawn using a frame. The word alt is placed inside the frames namebox. The larger rectangle is then divided into what UML 2 calls operands. 4 Operands are separated by a dashed line. Each operand is given a guard to test against, and this guard is placed towards the top
13、left section of the operand on top of a lifeline. 5 If an operands guard equates to true, then that operand is the operand to follow.Figure 8: A sequence diagram fragment that contains an alternative combination fragmentAs an example to show how an alternative combination fragment is read, Figure 8
14、shows the sequence starting at the top, with the bank object getting the checks amount and the accounts balance. At this point in the sequence the alternative combination fragment takes over. Because of the guard balance = amount, if the accounts balance is greater than or equal to the amount, then
15、the sequence continues with the bank object sending the addDebitTransaction and storePhotoOfCheck messages to the account object. However, if the balance is not greater than or equal to the amount, then the sequence proceeds with the bank object sending the addInsuffientFundFee and noteReturnedCheck
16、 message to the account object and the returnCheck message to itself. The second sequence is called when the balance is not greater than or equal to the amount because of the else guard. In alternative combination fragments, the else guard is not required; and if an operand does not have an explicit guard on it, then the else guard is to be assumed.Alternative combination fragments are not limited to simple if then els
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1