

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.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. 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.
