keronwc.blogg.se

Sequence diagram examples
Sequence diagram examples










Optionally, a value that the receiver returns to the sender can be placed near the return arrow. If you want to show that the receiver has finished processing the message and returns control to the sender, draw a dashed arrow from receiver to sender. When a messages are used to represent method calls, each activation corresponds to the period during which an activation record for its call is present on the call stack. It starts when the message is received and ends when the object is done handling the message. The white rectangles on a lifeline are called activations and indicate that an object is responding to a message. A closed and filled arrowhead signifies that the message is sent synchronously. Most method calls in object-oriented programming languages are synchronous. Synchronous messageĪ synchronous message is used when the sender waits until the receiver has finished processing the message, only then does the caller continue (i.e. Near the arrow, the name and parameters of the message are shown. The arrow originates at the sender and ends at the receiver. When a target sends a message to another target, it is shown as an arrow between their lifelines. Note that the text of a class is not underlined, which is how you can distinguish it from an object. shared or static methods in some programming languages) can be sent to a class. Note however that the 'Type' part designates the type of the elements and not the type of the collection itself. Its basic notation isĪgain, a name and/or type can be specified. When you want to show how a client interacts with the elements of a collection, you can use a multiobject. A shorter name carries the same amount of information and doesn't clutter the diagram (e.g. don't use 'aStudent' for an instance of type Student). Try to avoid long but non-descriptive names when you're also specifying the type of the object (e.g. There are other anonymous objects of the same type and giving them names is the only way to differentiate them.

sequence diagram examples

  • You want to refer to it during the interaction as a message parameter or return value.
  • They can be displayed with icons as well :Īn object should be named only if at least one of the following applies Some often used stereotypes for objects are «actor», «boundary», «control», «entity» and «database». Some example :Īs with any UML-element, you can add a stereotype to a target. So 'Type' can be an abstract type as well.īoth name and type are optional, but at least one of them should be present. Note that the object doesn't have to be a direct instance of Type, a type of which it is an indirect instance is possible too. Where 'name' is the name of the object in the context of the diagram and 'Type' indicates the type of which the object is an instance. The lifeline is displayed as a vertical dashed line. Below the target, its lifeline extends for as long as the target exists. A target is displayed as a rectangle with some text in it. Objects as well as classes can be targets on a sequence diagram, which means that messages can be sent to them. To relate the comment to whatever diagram elements it is about, connect them with dashed lines. Note that this highlight is not part of the diagram itself.Īs with all UML diagrams, comments are shown in a rectangle with a folded-over corner : To clarify how execution switches from one object to another, a blue highlight was added to represent the flow of control. The diagram above shows how objects interact in the "rent item" collaboration when the item is not available during the requested period.

    sequence diagram examples

    The UML sequence diagram gallery contains many examples, but here's a typical sequence diagram based on a system use case scenario : For each key collaboration, diagrams are created that show how objects interact in various representative scenarios for that collaboration. Lower equals Later).Ī popular use for them is to document the dynamics in an object-oriented system. An important characteristic of a sequence diagram is that time passes from top to bottom : the interaction starts near the top of the diagram and ends at the bottom (i.e. UML sequence diagrams are used to show how objects interact in a given situation.












    Sequence diagram examples