• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

sequence diagram and class diagram

 
Ranch Hand
Posts: 834
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi, wondering is there any relation between sequence diagram and class diagram ? as what i know on sequence diagram is showing the sequence events that happen in between objects, would it means we have to include all the objects in sequence diagram to class diagram as well ? thank you and please correct me if i wrong
 
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There definitely is a relation between sequence and class diagrams.

Think of class diagram as explaining the structure of the model and the sequence diagram explaining the behavior of the model.

The vertical lines in the sequence diagrams represent instances of the objects that you have in your model. The classes of these instances are typically represented in the class diagram as well to show their relations to other objects.

Thus, if you have a horizontal line going from one object to another object in a sequence diagram, you would also see a relation in the class diagram between the same two objects.
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Alvin chew:
wondering is there any relation between sequence diagram and class diagram ? as what i know on sequence diagram is showing the sequence events that happen in between objects, would it means we have to include all the objects in sequence diagram to class diagram as well ?


Well, the relation between sequence diagrams and class diagrams is that they're both UML diagrams. That's about it.

Sequence diagrams describe the dynamic aspect of your design, i.e. which object invokes which methods of which other objects in which order, while class diagrams describe the static aspect of your design, i.e. which class inherits which and which classes have associations to which other classes.

Also, I'd really encourage you to not think of such rules as "have to ... all ..." because design is not supposed to be a bureaucratic act to satisfy corporate policy. It's supposed to help you get stuff done.
 
Lasse Koskela
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Lasse Koskela:
Well, the relation between sequence diagrams and class diagrams is that they're both UML diagrams. That's about it.


To clarify my position on this, I'm not trying to say Sathya's wrong in any way. I just wanted to stress that there isn't a "strong" link between the two kinds of diagrams even though there of course is a relation if the two diagrams are being used to describe the same design.
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually there is a variant of the Fusion methodology which uses UML and has very formal rules such as "if you have a method call from an instance of A to an instance of B in a sequence diagram, there needs to be an association from A to B in the class diagram".

In my limited experience, the biggest effect this has is that it makes the design more rigid - simply because just making a very small change results in *a lot* of work. It might be intellectually satisfying, but simply doesn't provide enough value to be a reasonable practice in commercial projects.
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sathya was very careful and precise in using "object" and "class". Following that closely may help see how the static and dynamic views of the system are complementary.
 
It's just a flesh wound! Or a tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic