Re: class diagram question
From: Uncle Bob (Robert C. Martin) (u.n.c.l.e.b.o.b_at_objectmentor.com)
Date: 12/20/03
- Next message: Uncle Bob (Robert C. Martin): "Re: Is MVC still a valid pattern?"
- Previous message: Uncle Bob (Robert C. Martin): "Re: Abstract class question"
- In reply to: Passero: "class diagram question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 20 Dec 2003 10:29:48 -0600
"Passero" <yanongena@pandora.be> might (or might not) have written
this on (or about) Fri, 19 Dec 2003 12:04:51 GMT, :
>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?
You don't *have* to draw any link you don't want to draw. UML
diagrams are about communication, not declaration. Indeed, it is
often more important to leave things *out* of a UML diagram, than to
include them.
If, however, you want to communicate to your readers that methods of
class X invoke static methods of class Y, then you should draw the
association. You can stereotype it with <<static>> if you like.
>Is it the
>same when i parse an object of another class as a parameter but still don't
>use it as an atribute?
Almost. I usually use <<parameter>> stereotypes on associations to
denote that. Martin Fowler prefers dependency arrows.
>
>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 ?
Again, you don't *have* to. If you think it helps your readers, then
go ahead.
Robert C. Martin | "Uncle Bob"
Object Mentor Inc. | unclebob @ objectmentor . com
501 N. Riverside Dr.| Tel: (800) 338-6716
Suite 206 | Fax: (847) 775-8174 | www.objectmentor.com
| | www.XProgramming.com
Gurnee, IL, | Training and Mentoring | www.junit.org
60031 | OO, XP, Agile, C++, Java, C# | http://fitnesse.org
- Next message: Uncle Bob (Robert C. Martin): "Re: Is MVC still a valid pattern?"
- Previous message: Uncle Bob (Robert C. Martin): "Re: Abstract class question"
- In reply to: Passero: "class diagram question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|