Search code examples
umlclass-diagramsequence-diagram

Class Diagram to Sequence Diagram Rule


I have a specific question about this conversion. I saw different examples and I am confused at this point: Do I have to draw all classes in class diagram while drawing sequence diagram?


Solution

  • No, you don't have to do that. A class diagram shows a static view of a system. And it only shows that part of the system which is relevant. Only very small systems go into a single diagram. For large systems you create multiple sub-domains you can represent in a single diagram. Wall papers are more or less just for the show.

    A sequence diagram in contrast shows actual behavior of the system. And again a SD will not show the complete behavior of the system. That even more than class diagrams since behavior is exponentially more complex than anything static. So for a SD you will highlight only a certain part of behavior where only certain classes of the system take part in the communication. And even then you are allowed to leave away parts of the communication if they are not really relevant for what you want to show. A SD is created to highlight only some part of the behavior. In that respect you create as many SDs as needed.

    As commented, what you put in a SD are lifelines which represent instances of a class, not the class itself.