Link to home
Start Free TrialLog in
Avatar of _Esam
_Esam

asked on

UML diagram in Visio

Hi,

A quick question.
How do I draw this in Visio -             Object[]
I want show a method returning an array of Object.
How I do that in Visio?

Thax.
_Esam
ASKER CERTIFIED SOLUTION
Avatar of fffej78
fffej78

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of _Esam
_Esam

ASKER

Well,
I tried to draw the diagram...but I couldn't find (don't know:) the symbol of [] for a returned method??
How I do that?
And,
In terms of showing association --- the returned type is just being used in a method with a local variable declaration.

Like this:

Class Super{

public ReturnedClass getData(bool){

ReturnedClass rt = new ReturnedClass();

}

}

What is the correct way of showing the relationship?

Thanks
_Esam
Not sure exactly how you specifiy that it returns an array in Visio (from memory I think you can do it).  

In terms of an association, you'd draw a line between the two.  Call it the "data association" and specify

            (data)
Super -------> ReturnedClass
           (1)   (1)

So there is a relationship between the two called "data" (or getData if you prefer).  You specify the role name (data) at the end of the association with the arrow) and the "arity" with the number at either end.

So there is a one to one relationship between Super and the associated class ReturnedClass.  And you get to a ReturnClass from Super by means of the "data" association (or whatever name you give it).
Avatar of _Esam

ASKER

This is what I need to know---

What are the differences between associations ---------- of types----

When having an instance variable of another class within a class  vs. having the other class being declared locally within a method and returning its type?
How do I distinguish these two??? in the relationship diagram?

Like so:

Class MyClass{
private AnotherClass ac = new AnotherClass();

DoSomething(ac);

}

VS

Class MyClass{

public AnotherClass getData(){
 AnotherClass ac = new AnotherClass();
 ac.DoSomeOtherThing();
 return ac;
}

}

There should be some difference between showing these both types of associations?

_Esam
I'd represent an instance variable (as in your first example, with the private AnotherClass, using an association link (a solid line with an open arrow).

See http://www.larrykagan.com/media/References/umlReference.html and look for the section on "Association" (perhaps consider the aggregation relationship too)

In the second example, this is a transient (temporary) use of the AnotherClass.  This would be captured using a dotted line with an open arrow, meaning a dependncy relation.  Again see http://www.larrykagan.com/media/References/umlReference.html for more details.

Avatar of _Esam

ASKER

I am really trying to clarify myself....:)

So, ________> (pardon bad formatting:) is for an association of the first kind?
      -----------> association for weak type ....?

What about extends/implements ?

Please mention extends/implements relationship (diagram notation) between types class/interface...
When to use what???

Thanks.
_Esam.
Avatar of _Esam

ASKER

If Class A implements Interface B then

A __________> B


If Interface A extends Interface B then

A __________|> B


If Class A extends Class B then ??????????

If Class A has strong association with Class/Interface B

then, A __________> B

If Class A has weak association with Class/Interface B

then, A ----------------> B


Let me know if I am right???
Let me know the answer to ????

Thanks.
_Esam
Implements and extends are both represented by the same symbol which is a solid line with a closed arrow at the end (e.g. the associated between A and B in the first examples would be represented by the same line).

Strong association would be a solid line with a open arrow.  You mark the arity at either end and give it a name too (names are important!).  Arity just means how many are associated for example you might annotate the line if A contains three lots of B's.

"Weak" association is just a dependency, so I think you are right (dashed line, open arrow).
Avatar of _Esam

ASKER

>Implements and extends are both represented by the same symbol ???

So Class A implementing Interface B
    Interface A extending Interface B
    Class A extending Class B

Are all: A _____________|> B

?

I thought there are some differences!!
_Esam...
Both extending an interface and extending a class are examples of generalisation, which is represented by the solid line with the closed arrow.  

This might be useful in explaining http://atlas.kennesaw.edu/~dbraun/csis4650/A&D/UML_tutorial/class.htm
Avatar of _Esam

ASKER

>Both extending an interface and extending a class are examples of generalisation, which is represented by the solid line with the closed arrow.

So, How do I represent:

Class A implements Interface B ?


_Esam.
Avatar of _Esam

ASKER

Going back to the Original Question:

>How do I draw this in Visio -             Object[]

I figured it out...
There are options on using prefix, suffix for the operations; that's where I can include it.

Thanks...
_Esam
With a solid line with a closed arrow.  The end of the arrow should be at B

It should look like A ----|> B
Avatar of _Esam

ASKER

Ok..then...

An interface IA extending another interface IA,
a class CA extending another class CB, and
a class CB implementing an interface IB ----

all are represented...in diagram.......

IA ___|>IB
CA___|>CB
CB___|>IB ........

Right?

Thanks..a  lot..

_Esam.
Yes