We wrap up the week with where we left off with Sequence Diagrams and a look into more advanced elements. Today we will concentrate on the use of Gates in Sequence Diagrams.
The previous post illustrated how to reference another sequence diagram via sending across data through parameters and also return values. Yet, there’s another way to send across data between two sequence diagrams. Gates could be regarded as being a simple way to model the passing of data between a sequence diagram and its context. A gate is a message that is highlighted with one end connected to the sequence diagram’s frame’s edge and the other end connected to a lifeline. A reworking of Figure 1 (from Part 1 of this series) using gates can be seen in the following diagram.
Figure 2 (from Part 1 of this series) with the utilization of gates would look like what is shown below.
Figure 2 has an entry gate called getBalance that takes the parameter of accountNumber. The getBalance message is an entry gate, because it is the arrowed line that is linked to the diagram’s frame with the arrowhead linked to a lifeline. The sequence diagram has an exit gate, which returns the balance variable. The exit gate is known, because it’s a return message that is connected from a lifeline to the diagram’s frame with the arrowhead connected to the frame.
The real purpose behind these recent posts on Sequence Diagrams have been to offer anyone, irrespective of their experience in UML, with an effective “crash course” in understanding this area. We think this aim has been achieved. After this series is over (stay tuned for Part 3 next week!), we hope to bring more interesting insights into UML during the coming weeks and months. Till then, Happy Diagramming!