Re: class diagram question

From: H. S. Lahman (h.lahman_at_verizon.net)
Date: 12/19/03


Date: Fri, 19 Dec 2003 21:59:00 GMT

Responding to Passero...

> When i have a class that uses a static method of another class, do i have to
> draw a link between those classes in my class diagram or do I only need to
> draw the link when i'm using an instance of a class in my class? Is it the
> same when i parse an object of another class as a parameter but still don't
> use it as an atribute?
>
> In java it would be something like this:
>
> public void myFunction()
> {
> Myclass.doMethod(aClassOfMine)
> }
>
> aClassOfMine is an instance of a self-written class and MyClass is another
> class.
> In MyClass i only use aClassOfMine in the method doMethod so do i have to
> draw a link between the class that calls doMehod and MyClass and do i also
> have to draw a link between MyClass and ClassOfMine ?

It may be obvious from the Java syntax, but I don't know Java that well
so I have some questions.

(1) Which method is the static method?

(2) What class owns the static method?

(3) What class owns myFunction?

(4) What do you mean by a "self-written class"?

To answer your questions in general... One needs a line in the
Interaction Diagram for any behavioral collaboration between different
objects. That includes objects that are passed as method arguments if
the method invokes a behavior of the passed reference. (Passing an
object reference is just one way to instantiate a relationship.)

It really doesn't matter whether the method being invoked is static or
not. (Whether it is static only affects the way the message is
addressed.) If one is really concerned about static vs. member methods,
one can direct the arrow to an object swimlane that is not qualified
with specific identifier while directing member method calls to
swimlanes with a specific object identifier. (Though people very rarely
draw Interaction Diagrams with swimlanes qualified by identifiers
because of the clutter it tends to add to the diagram.)

*************
There is nothing wrong with me that could
not be cured by a capful of Drano.

H. S. Lahman
hsl@pathfindermda.com
Pathfinder Solutions -- Put MDA to Work
http://www.pathfindermda.com
(888)-OOA-PATH



Relevant Pages

  • Re: Hey, Jobst, on p39 of The Bicycle Wheel the graph appears to show the ?impossibility of...
    ... On a drawing with the scale of Jobst's figure, ... small displacements either side of zero. ... What's confusing about the diagram is that it's showing a different ... and because the left lateral force line is drawn ...
    (rec.bicycles.tech)
  • Re: DCC occupancy detections false positives
    ... Could you perhaps draw up a version in Paint that could be posted somewhere? ... The four ordinary diodes on the left are most easily found together in ... short out the rectifier's `+' and `-' terminals ... the diagram at that link looks better. ...
    (rec.models.railroad)
  • Re: Hey, Jobst, on p39 of The Bicycle Wheel the graph appears to show the ?impossibility of...
    ... that is actually a graph of. ... Actually I did say I would draw the diagram differently in the sense ... After numerous posts apparently criticising the drawing, ...
    (rec.bicycles.tech)
  • Re: Rigid rod problem
    ... >>that sense it's not a surprising result at all. ... >>diagram and, say, pick some point on the leftmost ... >>hyperbola and draw the tangent there. ...
    (sci.physics.relativity)
  • Re: class diagram question
    ... >draw a link between those classes in my class diagram or do I only need to ... class X invoke static methods of class Y, ... >aClassOfMine is an instance of a self-written class and MyClass is another ...
    (comp.object)