What does 0..* mean in a uml sequence diagram - uml

I would like to know if we can use 0..* in a UML sequence diagram.
Incase if we can , could anyone please explain what does it mean in the perspective of a sequence diagram?

Take a look at the use cases of sequence diagrams from this link. It is stated that:
A sequence diagram shows an interaction, which represents the sequence
of messages between instances of classes, components, subsystems, or
actors. Time flows down the diagram, and it shows the flow of control
from one participant to another. Use sequence diagrams to visualize
instances and events, instead of classes and methods. More than one
instance of the same type can appear on the diagram. More than one
occurrence of the same message can also appear.
One to one, zero to many, one to many etc. are class diagram relationship indicators and you can not use them in sequence diagrams because they are irrevelant.
Also, you may want to take a look at this link

Related

At a high level is it unreasonable to expect that the interface of classes in a sequence diagram look like their counterparts in the class diagram?

The picture is taken from the book "UML # Classroom". The text says "the registration is via e-mail, that is, asynchronous".
In actuality, I believe, there would be no "Student" and "Professor" objects involved in the process. Rather an interface, a call to a mail server and in general, nothing that would tell the viewer of the diagram what is really going on.
That makes sense to me because it has an illustrative purpose. The methods of the classes in the sequence diagram would only resemble the methods in a class diagram at a low level.
If I am tasked with a high level view of class diagram and high level sequence diagrams of a particular interaction, if I am then asked why the classes of the class diagram don't have any of the methods of the sequence diagram, am I right to say that they simply don't have to?
Should I reach a compromise with the sequence diagram wherein I try to make the calls similar to what will be going on in the program?
The methods of the classes in the sequence diagram would only resemble the methods in a class diagram at a low level.
Not necessary, all depends on the goal of the sequence diagram, you can have classes at design level (may be allowing to generate code) but having them in a sequence diagram giving a semantic (high) level. You can also show these classes in class/package/... diagrams without low detail so not at design level.
The only rule is to have diagram saying something useful, and following UML specification of course. Do not forget UML is not a method but a language, it does not indicate how it must be used.
Remark you can put note in a diagram to help saying explicitly its level/goal in case you are afraid it is confusing because not 100% limited/dedicated to design even using classes part of the design.
if I am then asked why the classes of the class diagram don't have any of the methods of the sequence diagram, am I right to say that they simply don't have to?
yes, because the goal is not necessary to show a sequence of calls but for instance a higher level.
Should I reach a compromise with the sequence diagram wherein I try to make the calls similar to what will be going on in the program?
Of course you can do too.
Notice a sequence diagram (so in fact an interaction) has limited features, while for instance an activity allows to model a behavior in detail without the same limitations.

Sequence Diagram vs Usecase Diagram

I have build a usecase diagram for hotel reservation
Should i build a sequence diagram for each usecase in the usecase diagram, or can i summarize multiple usecase in a single sequence diagram?
A use case diagram shows how use cases and actors relate to each other and gives a usefulness system overview. Use cases boil the system down to their added values and do not show how these are achieved.
Any scenario of a use case is graphically represented in an activity diagram where the single steps occur as actions.
A sequence diagram is used to show how objects communicate.
Usually you derive classes and relate them to actions of the use case activities. So when you create a sequence diagram it highlights a certain aspect of the whole system. This highlight is usually spot on and not a floodlight. Putting multiple use case scenarios in a single SD would for sure simply blind any reader instantly.
Usecase diagram
Use case diagrams show business use cases, actors, and the relationships between them. The relationships between actors and business use cases state that an actor can use a certain functionality of the business system. You will not find any information about how or in what chronological sequence these services are rendered
sequence diagram
A sequence diagram can map a scenarios described by a use case in step by step detail to define how objects collaborate to achieve your application's goals.
Here is the diagram , which will clear things better to you

sequence diagram for books exchange

Please can anyone suggest any improvements or corrections in the attached sequence diagram. The diagram is regarding student registration and search book.
You should not think on classes creation being in sequence diagram. Make a class diagram, maybe an object diagram, and after that make your sequence diagram with instances of created classes as timelines. Add a class diagram here, without it it is impossible to answer your questions.
As is, you are working with elements of use case diagram (agents), not classes. It is acceptable, too. But then you should create a component diagram and use components as timelines.
So, your problem is that you have minimally one diagram less than you should. A whole diagram, not a block in one.
So, for this task you can use the following sets of diagrams:
The fullest one: Use Case + State + Component + Communication + Sequence + Class + Object + Composite Structure
The wide refactoring of your diagram: Component + Sequence + Class + Object
The minimalistic refactoring: Sequence + Class
Of course, you can make more than one diagram of any kind mentioned. Also, some diagrams if they are small, can be combined in one - UC+State, for example.
The normal process is creation one diagram after another, returning to the previous ones. Behaviour/structure diagrams of the same level can be created simultaneously. If you have problems with some thought on one diagram, try to express it on another one.
Yes, you can do a sequence diagram for every action of use case or even of Activity/communication diagram. But if your seniors won't make you to do it, it is enough to create only these diagrams that are needed for better understanding of the process.
Sequence diagrams, in the context you're using them, should be modeling a single path through a use case. Think of it this way: a use case diagram models the different things that a system does and who interacts with it. An activity diagram models out the behavior of a single use case. A sequence diagram models out a single path through a use case (in other words, a single path through an activity diagram that models a use case).
In the case of your above sequence diagrams, it looks like you have two use cases: "Login" and "Create Account". Create account extends login. I would suggest that you first document in detail what each use case does (google "Use case narrative" for more information). Use an activity diagram if it helps clarify the narrative. Then look at the individual paths through the use case (google "use case scenario" for more information), using sequence diagrams to help clarify the scenarios as necessary.

differences between sequence diagram and collaboration diagram

As i read through UML specification superstructure that there is sequence diagram and there is a collaboration diagram
so,What is the differences between
sequence diagram and collaboration diagram?
Sequence and collaboration diagrams both aim at describing the dynamic interactions between objects.
The information you can describe are basically the same, but the two models have a different focus:
Sequence diagrams highlight more the temporal aspect, by showing invocation and responses along a (vertical) timeline and by explicitly showing the activation time of objects.
Sequence diagrams show how objects communicate with each other in terms of a temporal sequence of messages. The time flow is the most visible aspect in these diagrams, as messages are sequenced according to a vertical timeline and also the lifespan of objects associated to
those messages is reported. The figure below (taken from our book) shows an example of a sequence diagram describing 3 objects (instances of classes Shipment, Invoice and PartList) and the messages exchanged between each other. Interaction diagrams describe execution scenarios of the system.
Collaboration diagrams aim at showing the communications that happen between objects, by defining messages that flow between each other. They basically consist of superimposing the communication actions upon an object diagram. The temporal aspect can be shown here too, by numbering the interactions with sequential labels.
A collaboration diagram shows the interactions between objects or classes in terms of links (solid undirected lines connecting the elements that can interact) and messages that flow through the links. This describes at the same time some kind of static structure (links and nodes) and dynamic behavior (messages) of the system. An example is shown below.
UML1: These diagrams are the same, but present data from different points of view.
UML2: The Collaboration diagram is renamed to Communication diagram (there were misunderstanding since people thought that Collaboration diagram was used to show collaborations).
These diagrams are almost the same, but present the Sequence diagram has much more possibilities for visualization (for example, combined fragments, state invariants).
Sequence diagrams specify interaction in a time sequence manner which may be among objects and/or classes. These diagrams are created during early elaboration phase where each flow of the use case is defined in terms of sequences , i.e. after each step what is going to happen next. This kind of representation is very helpful to understand & discuss the use cases with the customer, where both can come out with all possible functional aspects.
On the other hand collaboration diagram provides a direct interaction among the object. These diagram seem to used more in the design phase of the development when you are designing the implementation of the relationship.
There is a difference between sequence diagrams and collaboration diagrams. Sequence diagrams shows object interaction in timely manner(so no need of numbering the messages). But collaboration diagram doesn't show object interaction in timely manner. (need to numbering the messages).
NOTE:
Now Collaboration diagrams are also called as communication diagrams.
A Sequence diagram is dynamic, and, more importantly, is time ordered. A Collaboration diagram is very similar to a Sequence diagram in the purpose it achieves; in other words, it shows the dynamic interaction of the objects in a system. A distinguishing feature of a Collaboration diagram is that it shows the objects and their association with other objects in the system apart from how they interact with each other. The association between objects is not represented in a Sequence diagram.
Link : http://www.developer.com/design/article.php/3102981/Collaboration-Diagram-in-UML.htm
Use sequence diagrams to show time and to emphasize the sequence or
the ordering of the interactions.
Use communication diagrams to emphasize the links among the
participants. Communication diagrams can be a helpful supplement
to the object diagrams.

which should be drawn first , class or sequence diagram?

I've had this discussion with my professor at college about UML diagrams .
He believes that sequence diagrams should be drawn before getting to class diagrams, but I think the opposite . I think after finishing the usecase diagram , the next diagram should be class diagram and after that we should get to sequence diagram.
Rational rose requires us to use the classes in sequence diagram, which are already in class diagram.
Can anyone help me with this?
I think you're both wrong. They should be drawn at the same time. As you're drawing your sequence diagram, you will undoubtedly come up with properties that you will need to keep track of the state, or that you hadn't thought of if you do the class diagram in a vacuum.
Of course, this is highly subjective and personal, but years of real-world experience (as opposed to academic theory) have taught me to work on both at the same time. MAYBE starting with the class diagram, but the class diagram invariably changes when you start going through process flows.
Well it depends a lot on how you plan to do things. I think it's a subjective matter. If you rather explain the actions performed for your usecases and after this has been done write the classes based on what you need to perform the sequences your professor is right.
But if you prefer to determine what the structure of your classes are and then adapt the action sequence to this then you would do the class diagram first and later the sequence.
In my experience I do them concurrently. I put the fundamental attributes to the class diagram but not the actions, and while I do the sequence diagram I add the methods and attributes that I need to the class diagram.
There is no one standard answer. There are several opinions, approaches and methods. In Unified Process I believe you first identify use case and then make realizations for them, e.g. sequence diagrams. As in use cases, there are actors and the systems and/or its parts interacting ina sequence. Actually this interactions should help you decompose your design and get to classes. Once you have classes on the analysis level, you can go further to design classess and design interactions. However these are quite a lot to draw in a diagram, most of the times code is the best documentation on this level, even generated diagrams are too large and more difficult to understand then code itself.
To prepare sequence diagram you need classes not the class diagram
You can prepare empty classes on the fly while in process of preparing sequence diagram....
Identification class objects in be part of preparing sequence or you can try to identify your objects before hand....
sequence is logical process while class diagram is end output
I don't think there is an order for creating diagrams since both are two different views of a system: class diagram structural (static) and sequence is behavioral (dynamic). I would start with sequence diagrams since you will discover more classes to create as you go through sequences. Do whatever makes sense for you at the time. If your doing more object oriented programming, I would consider doing classes before sequences.
Structural and behavioural models for all but the very simplest systems are naturally created simultaneously and iteratively, refining both over time.
You may have some method of "object discovery" such as CRC cards, which will yield a set of initial classes, with collaborations (the classes they interact with) and responsibilities, which informs both the methods they will need, and internal behaviour/state/activity.
You may then want to explore the use cases and scenarios using sequence or communication diagrams, this will expose the details of the required object communication and therefore inform the generation of public methods and relationships to refine the class diagram while at the same exploring the system behaviour which may yield further objects and classes to be created.
You may also want to explore the internal behaviour of classes, especially if they have stateful and/or active behaviour; activity ans state-machine diagrams are useful for this.
Either way I doubt that the use of Rational Rose is really the determinant of diagram creation order. Rational may require the classes on a sequence diagram to exist, but I imagine that they need not actually appear on a class diagram; they can probably equally be created on the sequence diagram and then later placed on a class diagram, or even created in the project explorer or whatever the equivalent is in that tool. Even if the only method of creating a class is to place it on a class diagram, that does not require you to refine and complete the class or its relationships before exploring interactions on a sequence diagram.
You need to buy some clothes, how you will proceed. You start choosing clothes first or you will decide first where to go? At the same time, will you go to shoe store if you want to buy shirt.
So both are iterative, but definitely first step is sequence on very high (component) level then drill down to class level sequence
You should first decide your application flow,means you should first draw a sequence diagram. It will show the flow of your application after this you should go for class diagram.

Resources