HI, I have a question while creating a sequence diagram. The question is: Class A is a subclass B When a message sent to A and the method taking care of the message is defined in B, should B also appear in the sequence diagram? What is the gerenal way to deal with subclass/subtype/inheritance in sequence diagram? Thanks a lot.
sequence just shows the sequence of the logic of the module in question. Do you feel there is need to identify which method is truly being called? Also I would guess that the purpose of having a parent clas have a reference to a subclass is that until runtime you won't know which subclass is actually being referred to. If this is not the case, then should the concrete subclass be referred to explictly? does the method being called whether on the subclass or parent class alter the sequence in some way? [This message has been edited by Geoff Tate (edited March 07, 2001).]
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR> fantastic, a towel? <HR></BLOCKQUOTE>
Joined: Mar 07, 2001
Thanks for the reply, the reason i ask is that it says sequence diagram is a good source to assign responsibility. In this case, there won't be able to distribute the responsibility among hierarchy through sequence diagram, and abstract class(generally serve as a super class) won't join the sequence diagram.
Hi visual_world, It depends on what you are trying to show. If it is important to show the specific concrete class that is handling the message (maybe this particular subclass has method calls to other classes that none of the other subclasses do) then show it, if it is only necessary to show the base class then do that. Would you please check the JavaRanch naming policy and re-register? Thanks, John
The only reason for time is so that everything doesn't happen all at once.
- Buckaroo Banzai
[To Geoff] There is a real need to show the exact method (message) being called as that's how OO programs behave - messages sent from one object to another. On the same thread of thought; if we can agree that we need to show subclasses & superclasses in the sequence diagram; then how about static method calls ? I have a sequence diagram which I would like people to critique. It is available at http://members.tripod.com/~codek/webservice_invocation.jpg Some notes (referring to the diagram):- a) Call is a subclass of RPCMessage. b) Message (3) & (4) are static method calls. I'm not sure how to present them in a sequence diagram! c) Message (13) & (14) is trying to model dynamic loading of classes by the JVM. I'm not sure if I got it right. Thanks everyone. Pho
[This message has been edited by Pho Tek (edited March 07, 2001).]
Joined: Feb 06, 2001
I think this diagram communicates very clearly the sequence of events taking place. That is the objective and I think this chart achieves it. As far as the fact that there is static method calls, I think you are ok because even though the call is made on the class and not the object instance, you can still reference the static method through the object instance name. I don't think the objective of the sequence diagram is to indicate implementation, but just the order of message communications between objects.
"run z", The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in again with a new name which meets the requirements. Thanks.