Re: class diagram question
From: H. S. Lahman (h.lahman_at_verizon.net)
Date: 12/19/03
- Next message: Phlip: "Re: OO Progress Metrics?"
- Previous message: Uncle Bob (Robert C. Martin): "Re: Is casting ever necessary?"
- In reply to: Passero: "class diagram question"
- Next in thread: Roger L. Cauvin: "Re: class diagram question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Next message: Phlip: "Re: OO Progress Metrics?"
- Previous message: Uncle Bob (Robert C. Martin): "Re: Is casting ever necessary?"
- In reply to: Passero: "class diagram question"
- Next in thread: Roger L. Cauvin: "Re: class diagram question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|