Sunrise
Sunrise

Reputation: 45

Convert Sequence diagram to Class diagram

I have to find a tools that convert diagrams, e.g. when I model a sequence program , i want it to generate automatically the correspondent class diagram.

I was told that doesn't exist. If there is no way to find, I hope you could give me some ideas how to create it .

Thank you .

Upvotes: 4

Views: 8757

Answers (3)

Novice
Novice

Reputation: 115

There's no way to automatically generate class diagrams from sequence diagrams; as @rai.skumar said, they serve for different purposes.

Why it's not possible to automatically generate class diagrams from sequence diagrams?

In the development process the class diagram appears, mainly, in two stages: project analysis and architectural project. The last comes right after the first (i.e there is no other "official" stage between them).

In the project analysis stage you get the Use Case (UC) descriptions from which you identify which classes are going to appear in your project for each UC; neither their responsibilities nor relationships are identified just yet. Once you have that, you may create a sequence diagram for each UC, identifying class relationships and attributes giving you the class analysis diagram.

The class analysis diagram could be automatically generated from the sequence diagrams since it is a direct mapping. Although it would not be very useful once you move on to the next stage, which is the architectural project, since you will modify the class analysis diagram by removing redundancies, adding project patterns, among other things.

For the record, collaboration diagrams (or communication diagrams) are commonly automatically generated from sequence diagrams by many software such as IBM's Rational Rose

Upvotes: 4

user513418
user513418

Reputation:

I don't know about tools, but you could manually generate a class diagram (at least a basic one) from a sequence diagram quite easily (you could also implement your own solution).

Basically, each swimlane represents an object of a particular type, so here are your classes. Furthermore, messages between swimlanes can (depending on the type of message) represent calls to operations. You'll also get the parameters and the return type, so you can have complete operation signatures - provided that your sequence diagram provides all the information.

Upvotes: 1

rai.skumar
rai.skumar

Reputation: 10667

Yeah; you were told right.

Class Diagram and Sequence diagrams serve different purpose and they complement each other. So it's not easy to generate one from other.

If you have code (i.e. classes) then you can generate Class Diagram but not using Sequence Diagram.

Upvotes: 2

Related Questions