Question regarding a very simple UML diagram

O

Oskar Bennet

Hi everybody,
I am supposed to draw a simple UML diagram for a very small project that
consists of less than a dozen classes. I have never been working with
UML before, I have read some tutorials but I cannot find the connection
between UML and my C++ code.

What I have found out so far is that inheritance is indicated by an
arrow like this

|\
------| >
|/

But I am not quite sure what type of connection is required between two
classes that are related the follwing way:

class myDataType
{
int foo;
...
}


class listElement
{
myDataType bar;
...
}

This is not what I would call inheritance so I assume that there is a
different type of connector. Does anybody have a clue of how to connect
these two classes in an UML diagram? I believe it could be similar to
this, but I am not really sure:

<>----------->

What would be the difference in an UML diagram if the second class would
be using a vector like that:

class listElement
{
<vector>::myDataType bar;
}

Maybe someone can recommend a _good_ UML tutorial that explains the
basics of UML in a way that is related to C++, all tutorials I found so
far are only rubbish.

Thanks in advance!
Oskar

PS.: Does anybody know a good tool for drawing UML diagrams? I just have
tried out dia but it is not very comfortable to use.
 
?

=?iso-8859-1?q?Kirit_S=E6lensminde?=

Hi everybody,
I am supposed to draw a simple UML diagram for a very small project that
consists of less than a dozen classes. I have never been working with
UML before, I have read some tutorials but I cannot find the connection
between UML and my C++ code.

What I have found out so far is that inheritance is indicated by an
arrow like this

|\
------| >
|/

Yes that's right. But the line can be solid or dashed and there is a
difference in meaning which I can't remember off the top of my head.
But I am not quite sure what type of connection is required between two
classes that are related the follwing way:

class myDataType
{
int foo;
...

}

class listElement
{
myDataType bar;
...

}

This is not what I would call inheritance so I assume that there is a
different type of connector. Does anybody have a clue of how to connect
these two classes in an UML diagram? I believe it could be similar to
this, but I am not really sure:

<>----------->

It's a one way relation with aggregation. It is a logical choice for
what you have for bar above.
What would be the difference in an UML diagram if the second class would
be using a vector like that:

class listElement
{
<vector>::myDataType bar;

}

You can put in parametrised types but I can never remember the UML
syntax so I tend to use C++ syntax for the type. I would have an
attribute that looked like this:

bar : std::vector said:
Maybe someone can recommend a _good_ UML tutorial that explains the
basics of UML in a way that is related to C++, all tutorials I found so
far are only rubbish.

I have some UML diagrams with explanations on my web site. They're not
intended for use as a tutorial but I do describe what the notation
means. There aren't that many right now, but I do add new ones from
time to time.

http://www.kirit.com/Categories:/UML

There are two important points to remember about UML. The first is
that the formal semantics is only a starting point and you will
probably end up making your own notation on top of UML. The second
comes from that first and is that UML doesn't describe the C++ that
you will write, the C++ source does that. The UML is a logical
structure of the code. There is no requirement that there be a one-to-
one mapping between UML classes and C++ class, UML attributes and C++
attributes etc.

When I write UML I am writing a simplified, but accurate abstraction
of the design of a system. Most of the classes in the UML that
represent logical business classes for an application will result in
up to half a dozen actual C++ classes.
PS.: Does anybody know a good tool for drawing UML diagrams? I just have
tried out dia but it is not very comfortable to use.

I use Rational Rose which is good but very pricey. Google StarUML
which made a good first impression on me, but I couldn't work out how
to annotate the diagram with the extra meta-data I need to drive my
UML compiler.


K
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top