Re: Normal way to visualize the structure of a program source-code?



Dear Pooya,

in brief, I get the impression that you are trying to model an ER
diagram in Chen notation with the UML shapes. In that case, use the ER
shapes.

A bit more verbose:
My intention is, to show, that Class_1 is providing some results after some calculations, which then will 
be provided to Class_2.

For the examples in the following text, I assume that a method of
Class_2 calls some method of Class_1 to retrieve a calculation result.

If you are trying to describe dynamic aspects of your system in UML, its
behavior (Class_1 calculates and provides results), you should use an
behavior description diagram like a UML sequence diagram, collaboration
diagram or activity diagram. You can not use a structure description
(UML class diagram, package diagram,..), at least you will not be able
to express all the desired information.

You can express a general dependency between Class_1 and Class_2 with a
dependency association (dashed arc from Class_2 to Class_1 for the used
assumption).
The rhombus arc is an aggregation or composition, which means that one
class incorporates another in a strong or weak way. But while this is
most likely the case in your scenario, it is not used to represent
return values or function calls. You could, however, represent the
access (caller to target) with this. For example, if your Class_2 had a
pointer or reference to an instance of Class_1, you could represent this
as an aggregation from Class_2 (rhombus side) to Class_1 (line side).
You can explicitly express the access direction with an arrowhead on the
line side.

To express the order of actions involving this two classes (call of
calculation function, call of result retrieval function), try a sequence
diagram. With this, you can directly represent the interactions (call of
functions) an even the returned results.
If you are not satisfied with the representation, you might use a
communication diagram (looks similar to a class diagram but describes
almost the same as a sequence diagram).

This is, what a friend of mine showed me. He is more familiar with UML and ER-Diagrams than me.

Now, an ER diagram describes relations between elements, similar to a
class diagram. However it is most often used to describe data
composition and relations, not program structure or actor classes. For
this purpose, the Chen notation is quite popular (DB systems). In that
notation there is a rhombus for a relation between two entities with
lines on both sides, an there exists your previously mentioned double
line, too. However, this is NOT a UML class diagram. Shapes for this
diagram type are available in Dia, in the ER sheet.

You can use a UML class diagram to model an ERD, but in that case you
would use named associations (as you do already). You could use
associations with a rhombus to express "part of" relations, however
since you seem to be new to UML I recommend against it.

If you want to use UML you might want to read a bit about the semantics
of the class diagram and sequence diagram, first. And keep in mind that
UML and the ER diagrams in Chen notation are two different things. Do
not mix them.

Regards,

Thimo Langbehn

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]