[Uml-devel] Bug or feature? Cant have same class appear more than once in class diagram

Luis De la Parra Blum lparrab at gmx.net
Thu May 15 11:20:25 UTC 2003


On Wednesday 14 May 2003 21:20, Brian Thomas wrote:
>
> 	Sentence   -    <subject>  - Topic
>
>           <predicate>
>
>           Topic
>
> 	where lines are assoications between classes and brakets describe
>         the name of the associations ("Sentence" and "Topic" are the 2
> classes).

well... while I agree that this limitation doesnt make much sense, I dont 
agree in your reasons. 
after all, you can have something like:

   Sentence --------------
    |                          |
<predicate>          <subject>
    |                          |
 Topic  --------------------

which is --semantically- exactly the same.

my reasons for allowing a class to appear twice in a diagram, is that we have 
to remember that what you see in the diagram is just a "Widget", that is, a 
visual representation of the Class, your class doesnt live in the diagram, 
but in the Model.
In your model there can only be one Class Topic, ( in its package ), but I 
dont see why you can't have more than one widget representing it. while my 
"diagram" and Brian's are really the same, Brian's representation may be 
easier to read.

> 	I can see a possible counterargument that it becomes hard to generate code
>         when a class appears more than one time in a diagram, but am not
> 100% sure its so bad.

where do you see the problems? you should generate the code based on the 
model's classes, not on the diagram's widgets-

What hapens if you have a diagram "A" with two classes c1 and c2, which are 
connected by some kind of association. 
Then you have another diagram "B" with classes c1 and c3, and you dont see any 
associations there because there is nothing connecting c1 and c3
so far so good... 
now, when you generate the code for c1 you should generate the association to 
c2 even if you started the generator while diagram "B" was the one visible.


>
> 	Comments? I guess I lean towards removing this limitation in Umbrello
>         if its not too hairy. I dont see any problem with UML rules as to
> why this cant happen.

just make sure when you make an association between two classes the check for 
"validity" has to be made against the classes, and not against the widgets.
Also need to make sure that they are *really* showing the same object. if you 
add an operation through one class widget, it is added to all because they 
are showing the same object (of course you can have different *display 
optioins* for each widget )

luis






More information about the umbrello-devel mailing list