Topic
5 replies Latest Post - ‏2009-06-03T19:21:26Z by SystemAdmin
SystemAdmin
SystemAdmin
1130 Posts
ACCEPTED ANSWER

Pinned topic question regarding sequence diagram

‏2007-03-14T16:58:05Z |
In a Sequence Diagram using UML 2.0, how would you model a parameter that is passed into a method and subsequently used to initialize a local variable?

For instance:

public static Properties loadProperties(java.net.URL url) <+ parameter
{
Properties props = null;
java.io.InputStream input = null;

...

try
{
input = url.openStream(); <+ inititialization
props = loadProperties(input);
}

....
Thanks in advance,

Darrell
Updated on 2009-06-03T19:21:26Z at 2009-06-03T19:21:26Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    1130 Posts
    ACCEPTED ANSWER

    Re: question regarding sequence diagram

    ‏2007-03-14T19:50:09Z  in response to SystemAdmin
    > In a Sequence Diagram using UML 2.0, how would you
    > model a parameter that is passed into a method and
    > subsequently used to initialize a local variable?
    >
    > For instance:
    >
    > public static Properties loadProperties(java.net.URL
    > url) <+ parameter
    > {
    > Properties props = null;
    > java.io.InputStream input = null;
    >
    > ...
    >
    > try
    > {
    > input = url.openStream();
    > tream(); <+
    > inititialization
    > props = loadProperties(input);
    > }
    >
    > ....
    >
    >
    > Thanks in advance,
    >
    > Darrell
    Sequence diagrams are not used to model the internal behavior of a method. You would show the input data as a parameter to your method. The method name and parameter are the message on the sequence diagram. The message goes to the object that contains the method you are describing. (hopefully my ASCII art comes out OK)


     
    Myobject
     



    loadProperties (java.net.URL) |
    ____________________________________\|
    /|

    Sequence diagrams show interactions between objects, and no other object needs to know how Myobject is going to use something of type java.net.URL.

    If you want to show the behavior of the method, then you want to use a protocol state machine to model the behavior of the object and the methods of the object.

    Geri

    Geri Schneider Winters
    http://www.writingusecases.com/
    Resources for Business Analysts
    • SystemAdmin
      SystemAdmin
      1130 Posts
      ACCEPTED ANSWER

      Re: question regarding sequence diagram

      ‏2007-03-14T20:10:31Z  in response to SystemAdmin
      Geri,

      First, thank you for your response. Just for clarification on my part would your response hold true for modeling an internal message of an object? For instance if my method call in turn called a private method on the same object wouldn't the second call be modeled?

      My situation is that I am attempting to model an application that currently exists and want to ensure that the diagrams (and meta data behind them) contain all of the necessary information.
      Thanks,

      Darrell
      • SystemAdmin
        SystemAdmin
        1130 Posts
        ACCEPTED ANSWER

        Re: question regarding sequence diagram

        ‏2007-03-14T20:30:39Z  in response to SystemAdmin
        The internal method call could appear on a sequence diagram as a call from the object to itself. It could also be shown on a state diagram. You can make a state diagram (protocol state machine) for an object, showing all of the methods of that object, internal and external, and the behavior of the object.

        Geri

        Geri Schneider Winters
        http://www.writingusecases.com/
        Resources for Business Analysts
        • SystemAdmin
          SystemAdmin
          1130 Posts
          ACCEPTED ANSWER

          Re: question regarding sequence diagram

          ‏2009-06-03T06:25:04Z  in response to SystemAdmin
          Hi,

          Can we show Behaviors in the Sequence Diagram and also pass parameters and access return values from these.

          thanks in advance
          satendra
        • SystemAdmin
          SystemAdmin
          1130 Posts
          ACCEPTED ANSWER

          Re: question regarding sequence diagram

          ‏2009-06-03T19:21:26Z  in response to SystemAdmin
          Hi,

          Can we show Behaviors in the Sequence Diagram and also pass parameters and access return values from these.

          thanks in advance
          satendra