Topic
  • 5 replies
  • Latest Post - ‏2008-03-05T19:35:47Z by SystemAdmin
ogeorg
ogeorg
2 Posts

Pinned topic Sequence diagram: representing call to method in base class

‏2008-02-28T12:57:19Z |
Hi,

I am wondering how to represent the following situation:

Class A has a protected method f().
Class B overrides method f(), and the implementation of B.f() makes a call to A.f() (using super.f())

Would it be correct to represent it as an arrow pointing back to the same column (object), but with
the method name "super.f()" or "A.f()" ?

Thanks,

Olivier
Updated on 2008-03-05T19:35:47Z at 2008-03-05T19:35:47Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    1130 Posts

    Re: [uml] Sequence diagram: representing call to method in base class

    ‏2008-02-28T14:21:19Z  
    Oliver,
    I feel your pain. This gets ugly when the client of the object only knows
    about class A and you want to show polymorphism as well as the call to
    super.f().
    This is sort of a weakness with Sequence Diagrams. If you modeling tool lets
    you, you could have two column(object)s with the same object name but
    different class names, and stereotype a dependency between them to show that
    they are the same object. I have always been frustrated with this aspect of
    sequence diagrams.
    Scott Fleming
    On 2/28/08, uml <disadmin@us.ibm.com> wrote:

    Hi,

    I am wondering how to represent the following situation:

    Class A has a protected method f().

    Class B overrides method f(), and the implementation of B.f() makes a call
    to A.f() (using super.f())

    Would it be correct to represent it as an arrow pointing back to the same
    column (object), but with

    the method name "super.f()" or "A.f()" ?

    Thanks,

    Olivier

    _______________________________________________
    uml mailing list
    uml@lists.ca.ibm.com
    Unsubscribe:uml-leave@lists.ca.ibm.com

    Scott Fleming
    Oliver,
    I feel your pain. This gets ugly when the client of the object only knows about class A and you want to show polymorphism as well as the call to super.f().
    This is sort of a weakness with Sequence Diagrams. If you modeling tool lets you, you could have two column(object)s with the same object name but different class names, and stereotype a dependency between them to show that they are the same object. I have always been frustrated with this aspect of sequence diagrams.

    Scott Fleming

     
    On 2/28/08, uml <disadmin@us.ibm.com> wrote:
    Hi,



    I am wondering how to represent the following situation:



    Class A has a protected method f().

    Class B overrides method f(), and the implementation of B.f() makes a call to A.f() (using super.f())



    Would it be correct to represent it as an arrow pointing back to the same column (object), but with

    the method name "super.f()" or "A.f()" ?



    Thanks,



    Olivier

    _______________________________________________
    uml mailing list
    uml@lists.ca.ibm.com
    Unsubscribe:uml-leave@lists.ca.ibm.com




    --
    Scott Fleming
    _______________________________________________
    uml mailing list
    uml@lists.ca.ibm.com
    Unsubscribe:uml-leave@lists.ca.ibm.com
  • SystemAdmin
    SystemAdmin
    1130 Posts

    RE: [uml] Sequence diagram: representing call to method in base class

    ‏2008-02-29T00:57:59Z  
    Oliver,
    I feel your pain. This gets ugly when the client of the object only knows
    about class A and you want to show polymorphism as well as the call to
    super.f().
    This is sort of a weakness with Sequence Diagrams. If you modeling tool lets
    you, you could have two column(object)s with the same object name but
    different class names, and stereotype a dependency between them to show that
    they are the same object. I have always been frustrated with this aspect of
    sequence diagrams.
    Scott Fleming
    On 2/28/08, uml <disadmin@us.ibm.com> wrote:

    Hi,

    I am wondering how to represent the following situation:

    Class A has a protected method f().

    Class B overrides method f(), and the implementation of B.f() makes a call
    to A.f() (using super.f())

    Would it be correct to represent it as an arrow pointing back to the same
    column (object), but with

    the method name "super.f()" or "A.f()" ?

    Thanks,

    Olivier

    _______________________________________________
    uml mailing list
    uml@lists.ca.ibm.com
    Unsubscribe:uml-leave@lists.ca.ibm.com

    Scott Fleming
    Oliver,
    I feel your pain. This gets ugly when the client of the object only knows about class A and you want to show polymorphism as well as the call to super.f().
    This is sort of a weakness with Sequence Diagrams. If you modeling tool lets you, you could have two column(object)s with the same object name but different class names, and stereotype a dependency between them to show that they are the same object. I have always been frustrated with this aspect of sequence diagrams.

    Scott Fleming

     
    On 2/28/08, uml <disadmin@us.ibm.com> wrote:
    Hi,



    I am wondering how to represent the following situation:



    Class A has a protected method f().

    Class B overrides method f(), and the implementation of B.f() makes a call to A.f() (using super.f())



    Would it be correct to represent it as an arrow pointing back to the same column (object), but with

    the method name "super.f()" or "A.f()" ?



    Thanks,



    Olivier

    _______________________________________________
    uml mailing list
    uml@lists.ca.ibm.com
    Unsubscribe:uml-leave@lists.ca.ibm.com




    --
    Scott Fleming
    _______________________________________________
    uml mailing list
    uml@lists.ca.ibm.com
    Unsubscribe:uml-leave@lists.ca.ibm.com
    In the code, does it look like this?

    super.f();

    If so, a reflexive call that says super.f() is perfectly clear to me.

    If the code looks like this

    A.f();

    Then a reflexive call that said A.f() would be the way to go.

    -----Original Message-----
    From: uml-bounces@lists.ca.ibm.com mailto:uml-bounces@lists.ca.ibm.com
    On Behalf Of Scott Fleming
    Sent: Thursday, February 28, 2008 7:21 AM
    To: uml@lists.ca.ibm.com
    Subject: Re: uml Sequence diagram: representing call to method in base
    class

    Oliver,
    I feel your pain. This gets ugly when the client of the object only
    knows about class A and you want to show polymorphism as well as the
    call to super.f().
    This is sort of a weakness with Sequence Diagrams. If you modeling tool
    lets you, you could have two column(object)s with the same object name
    but different class names, and stereotype a dependency between them to
    show that they are the same object. I have always been frustrated with
    this aspect of sequence diagrams.
    Scott Fleming
    On 2/28/08, uml <disadmin@us.ibm.com> wrote:

    Hi,

    I am wondering how to represent the following situation:

    Class A has a protected method f().

    Class B overrides method f(), and the implementation of B.f() makes a
    call to A.f() (using super.f())

    Would it be correct to represent it as an arrow pointing back to the
    same column (object), but with

    the method name "super.f()" or "A.f()" ?

    Thanks,

    Olivier

    _______________________________________________
    uml mailing list
    uml@lists.ca.ibm.com
    Unsubscribe:uml-leave@lists.ca.ibm.com
    Scott Fleming

    _______________________________________________
    uml mailing list
    uml@lists.ca.ibm.com
    Unsubscribe:uml-leave@lists.ca.ibm.com
  • SystemAdmin
    SystemAdmin
    1130 Posts

    RE: [uml] Sequence diagram: representing call to method in base class

    ‏2008-02-29T01:01:35Z  
    By the way, these discussions go easier if we use the UML vocabulary:

    Operation: What a class can do. f() is an operation.
    Method: HOW a class realizes the operation. The code is the method.

    So in your last thought, the "operation name" is super.f or A.f...

    Class B provides it's own METHOD for the f() OPERATION.
    Class A ALSO provides its own method for the f()operation.

    B's method calls A's method as part of Bs solution to the f() operation.

    More clear? Well... Maybe not as much more as I'd hoped. :(

    --ant

    -----Original Message-----
    From: uml-bounces@lists.ca.ibm.com mailto:uml-bounces@lists.ca.ibm.com
    On Behalf Of uml
    Sent: Thursday, February 28, 2008 5:57 AM
    To: uml@lists.ca.ibm.com
    Subject: uml Sequence diagram: representing call to method in base
    class
    Hi,

    I am wondering how to represent the following situation:

    Class A has a protected method f().

    Class B overrides method f(), and the implementation of B.f() makes a
    call to A.f() (using super.f())

    Would it be correct to represent it as an arrow pointing back to the
    same column (object), but with

    the method name "super.f()" or "A.f()" ?

    Thanks,

    Olivier
    _______________________________________________
    uml mailing list
    uml@lists.ca.ibm.com
    Unsubscribe:uml-leave@lists.ca.ibm.com
  • ogeorg
    ogeorg
    2 Posts

    Re: Sequence diagram: representing call to method in base class

    ‏2008-03-05T11:20:53Z  
    Thanks Scott and Anthony,

    So I didn´t miss anything, there just is no definite way of specifying this.

    So the 2 ways of doing it are:

    1) 2 columns for the same object, one for each class.
    Scott: how would you write the stereotype dependency?

    2) 1 column, with a reflexive call super.f() or A.f(), depending on what is in the code.

    Thanks again,

    Olivier
  • SystemAdmin
    SystemAdmin
    1130 Posts

    Re: [uml] Re: Sequence diagram: representing call to method in base class

    ‏2008-03-05T19:35:47Z  
    • ogeorg
    • ‏2008-03-05T11:20:53Z
    Thanks Scott and Anthony,

    So I didn´t miss anything, there just is no definite way of specifying this.

    So the 2 ways of doing it are:

    1) 2 columns for the same object, one for each class.
    Scott: how would you write the stereotype dependency?

    2) 1 column, with a reflexive call super.f() or A.f(), depending on what is in the code.

    Thanks again,

    Olivier
    Oliver,
    I don't know which modeling tool you are using. If your tool allows, draw
    the dependency arrow to the derived from the base class as <<same
    instance>>, and label both columns with the same object name. Actually,
    since there is no standard, you could use a different name for your
    stereotype to help communicate your intent. If you follow my lead, it will
    look like this:

    ______________ <<same instance>>
    _________________
    <table class="jive-wiki-table">
    <tr>
    <td> myObject: Base </td>
    <td> ------------------------------------------> </td>
    <td> *myObject:
    Derived*
    </td>
    </tr>
    <tr>
    <td>______________</td>
    </tr>
    <tr>
    <td>_________________</td>
    </tr>
    </table>


    <table class="jive-wiki-table">
    <tr>
    </tr>
    <tr>
    </tr>
    </table>


    <table class="jive-wiki-table">
    <tr>
    </tr>
    <tr>
    </tr>
    </table>


    <table class="jive-wiki-table">
    <tr>
    </tr>
    <tr>
    </tr>
    </table>


    <table class="jive-wiki-table">
    <tr>
    </tr>
    <tr>
    </tr>
    </table>


    <table class="jive-wiki-table">
    <tr>
    </tr>
    <tr>
    </tr>
    </table>


    Then show the messaging between these levels of abstraction as you wish to
    represent the pattern you intend to communicate. For example, if you wanted
    someone to call the base class method f(), you could show a messaging coming
    from a client to myObject:Base and show it implemented as a call directly to
    the method of the same name in myObject:Derived. To go the other way, show
    the call from myObject:Derived to myObject:Base and indicate super.f() on
    the message.

    This is not ideal, but it works and I don't see any other mechanism in UML
    for representing behavior that is distributed vertically through a
    generalization relationship such as is found in several of the GoF Design
    Patterns.
    I hope this was helpful,
    Scott

    On 3/5/08, uml <disadmin@us.ibm.com> wrote:

    Thanks Scott and Anthony,

    So I didn´t miss anything, there just is no definite way of specifying
    this.

    So the 2 ways of doing it are:

    1) 2 columns for the same object, one for each class.

    Scott: how would you write the stereotype dependency?

    2) 1 column, with a reflexive call super.f() or A.f(), depending on what
    is in the code.

    Thanks again,

    Olivier
    _______________________________________________
    uml mailing list
    uml@lists.ca.ibm.com
    Unsubscribe:uml-leave@lists.ca.ibm.com

    Scott Fleming
    Oliver,
    I don't know which modeling tool you are using. If your tool allows, draw the dependency arrow to the derived from the base class as <<same instance>>, and label both columns with the same object name. Actually, since there is no standard, you could use a different name for your stereotype to help communicate your intent. If you follow my lead, it will look like this:

     
    ______________             <<same instance>>                 _________________
    | myObject: Base |  ------------------------------------------> |  myObject: Derived |
    |______________|                                                  &nbs p;          |_________________|
                |                          &n bsp;                                                     &nbs p;             |
                |                          &n bsp;                                                     &nbs p;             |
                |                          &n bsp;                                                     &nbs p;             |
                |                          &n bsp;                                                     &nbs p;             |
                |                          &n bsp;                                                     &nbs p;             |
     
    Then show the messaging between these levels of abstraction as you wish to represent the pattern you intend to communicate. For example, if you wanted someone to call the base class method f(), you could show a messaging coming from a client to myObject:Base and show it implemented as a call directly to the method of the same name in myObject:Derived. To go the other way, show the call from myObject:Derived to myObject:Base and indicate super.f() on the message.

     
    This is not ideal, but it works and I don't see any other mechanism in UML for representing behavior that is distributed vertically through a generalization relationship such as is found in several of the GoF Design Patterns.

    I hope this was helpful,
    Scott


     
    On 3/5/08, uml <disadmin@us.ibm.com> wrote:
    Thanks Scott and Anthony,



    So I didn´t miss anything, there just is no definite way of specifying this.



    So the 2 ways of doing it are:



    1) 2 columns for the same object, one for each class.

      Scott: how would you write the stereotype dependency?



    2) 1 column, with a reflexive call super.f() or A.f(), depending on what is in the code.



    Thanks again,



    Olivier


    _______________________________________________
    uml mailing list
    uml@lists.ca.ibm.com
    Unsubscribe:uml-leave@lists.ca.ibm.com




    --
    Scott Fleming
    _______________________________________________
    uml mailing list
    uml@lists.ca.ibm.com
    Unsubscribe:uml-leave@lists.ca.ibm.com