What is the difference between sequence diagram and communication diagram?

陌路散爱 提交于 2020-01-12 05:22:10

问题


Could anyone explain me what is the difference between sequence diagram and communication diagram?


回答1:


Both diagrams give the same information, but the sequence diagram emphasizes time in its layout and the communication diagram emphasizes the objects that are communicating in its layout.

Time is implicit in sequence diagrams (it is inferred by vertical position), while it is given explicitly in communication diagrams (via numbers).

To quote Scott Ambler

The main difference between communication diagrams and sequence diagrams is that sequence diagrams are good at showing sequential logic but not that good at giving you a “big picture view” whereas communication diagrams are the exact opposite.




回答2:


emphasizing the time ordering of messages (using sequence diagrams)

emphasizing the structural relationships among the objects that interact (using communication diagrams).

reference :UML user manual




回答3:


Sequence diagrams illustrate interactions in a kind of fence format, in which each new object is added to the right.

What might this represent in code? Probably, that class A has a method named doOne and an attribute of type B. Also, that class B has methods named doTwo and doThree. Perhaps the partial definition of class A is:

public class A
   {
   private B myB = new B();

   public void doOne()
   {
   myB.doTwo();
   myB.doThree();
   }
   // . . 
   }

Communication diagrams illustrate object interactions in a graph or network format, in which objects can be placed anywhere on the diagram (the essence of their wall sketching advantage).

What are the Strengths and Weaknesses of Sequence vs. Communication Diagrams?

Each diagram type has advantages, and modelers have idiosyncratic preference—there isn't an absolutely "correct" choice. However, UML tools usually emphasize sequence diagrams, because of their greater notational power.

Sequence diagrams have some advantages over communication diagrams. Perhaps first and foremost, the UML specification is more sequence diagram centric—more thought and effort has been put into the notation and semantics. Thus, tool support is better and more notation options are available. Also, it is easier to see the call-flow sequence with sequence diagrams—simply read top to bottom. With communication diagrams we must read the sequence numbers, such as "1:" and "2:". Hence, sequence diagrams are excellent for documentation or to easily read a reverse-engineered call-flow sequence, generated from source code with a UML tool.

But on the other hand, communication diagrams have advantages when applying "UML as sketch" to draw on walls (an Agile Modeling practice) because they are much more space-efficient. This is because the boxes can be easily placed or erased anywhere—horizontal or vertical. Consequently as well, modifying wall sketches is easier with communication diagrams—it is simple (during creative high-change OO design work) to erase a box at one location, draw a new one elsewhere, and sketch a line to it. In contrast, new objects in a sequence diagrams must always be added to the right edge, which is limiting as it quickly consumes and exhausts right-edge space on a page (or wall); free space in the vertical dimension is not efficiently used. Developers doing sequence diagrams on walls rapidly feel the drawing pain when contrasted with communication diagrams.




回答4:


A fundamental rule in Object Oriented Design is to use different diagrams based on diverse purposes. In this regard, sequence diagrams are used to model sequential logic while to show the behavior of several objects collaborating together to fulfill a common purpose the communication diagrams, formerly known as collaboration diagrams in UML 1.x, can be used. - Read more >> here << and >> here <<




回答5:


The below link is the short answer for difference between sequence diagram and communication. Please refer it.

difference between sequence diagram and communication



来源:https://stackoverflow.com/questions/10084771/what-is-the-difference-between-sequence-diagram-and-communication-diagram

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!