Author Topic: Multiple instances of a class in a diagram  (Read 9277 times)

Javier

  • EA User
  • **
  • Posts: 67
  • Karma: +0/-0
  • Necessity is the mother of email
    • View Profile
Multiple instances of a class in a diagram
« on: November 09, 2004, 09:00:03 am »
Is there a way to have more than one class instance of a class in a diagram?

My impression is that there isn't, but I'd like to confirm.  I am using version 4.10.732.
We must become the change we want to see.
- Ghandi

Bruno.Cossi

  • EA User
  • **
  • Posts: 803
  • Karma: +0/-0
    • View Profile
Re: Multiple instances of a class in a diagram
« Reply #1 on: November 09, 2004, 09:57:59 am »
Hi,

you can't place a class on a diagram more than once. A diagram can however contain multiple instances ("objects") of the same class.

Bruno

Javier

  • EA User
  • **
  • Posts: 67
  • Karma: +0/-0
  • Necessity is the mother of email
    • View Profile
Re: Multiple instances of a class in a diagram
« Reply #2 on: November 09, 2004, 12:03:17 pm »
Bruno,

Thx for the reply, but I don't think it'll serve my purpose because it is an instance.  The reason I need this feature--hint, hint, available in Rational Rose--is that I'm modeling two classes with multiple associations (generalization and containment) between them and the diagram just gets cluttered.

A (cheesy) workaround I've found is to create another class with the same name and create the associations there.

Regards.
We must become the change we want to see.
- Ghandi

thomaskilian

  • Guest
Re: Multiple instances of a class in a diagram
« Reply #3 on: November 09, 2004, 12:27:35 pm »
Javier,
in such cases I use two different diagrams. One for associations and one for generalization.

Javier

  • EA User
  • **
  • Posts: 67
  • Karma: +0/-0
  • Necessity is the mother of email
    • View Profile
Re: Multiple instances of a class in a diagram
« Reply #4 on: November 09, 2004, 01:02:50 pm »
Thomas,

The reason for all these requests is two-fold:

- I'm diagramming the UML2 specification for learning purposes, working towards my second UML certification.  I just decided to begin with the Kernel::Root diagram and guess what?  The first thing I find is Element and Comment being associated multiple times.  Each class is actually twice in the diagram, and for good reason: clarity.

- I'm testing Enterprise Architect's UML2 compliance.  So far I've found a few glitches--for example, tree-style for a generalization relationship is present, but not for the aggregation relationship, perhaps because it's less common?

Needless to say, I need the classes to be in the same diagram  :(


Regards.
We must become the change we want to see.
- Ghandi

sargasso

  • EA Practitioner
  • ***
  • Posts: 1406
  • Karma: +1/-2
  • 10 COMFROM 30; 20 HALT; 30 ONSUB(50,90,10)
    • View Profile
Re: Multiple instances of a class in a diagram
« Reply #5 on: November 09, 2004, 04:47:54 pm »
(very quietly)

There is a bug feature in 4.10.739 that let me create a whole set of multiple classes in a single diagram. It has something to do with changing element types - I do not choose to remember how I did it...

Let me tell you - you dont want it.  Multiple instances creates the createst mess of all when associations and other features are changed in other diagrams.  Even if it did work, the hassle it would create with link visibility is not bearable.

What would be nice is something we used in the early 1970's in data flow modelling and that is a duplicate icon for an element - if you senior practitioners remember it was a sort of an inverse of a UML note icon, a box with a filled in triangle in the bottom LHC or RHC - that represented "this element is some where else in this diagram" go see it for actual details.

The trick would be to be able to drag a link between  the original element and the "copyof" icon - this would not change the original link specs just where its geometry goes.

Bruce
« Last Edit: November 09, 2004, 04:54:01 pm by sargasso »
"It is not so expressed, but what of that?
'Twere good you do so much for charity."

Oh I forgot, we aren't doing him are we.

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +54/-3
    • View Profile
Re: Multiple instances of a class in a diagram
« Reply #6 on: November 09, 2004, 05:15:31 pm »
Javier,

I've just had a trawl through the UML2.0 and UML1.5 specifications trying to find the definitive answer as to whether you are allowed multiple instances on the same diagram and couldn't find an answer other than the precedent that they've used the feature themselves. It'd be tricky to implement (as hinted at by Sargasso) but we'll have a think about it...

Regarding the tree-style aggregate connectors, you are free to draw them tree-style by hand: I guess that makes us compliant, just not very helpful.  :-/ We'll have a look at how easy it would be to introduce tree-style for all connectors in the new year. I'm guessing easier than multiple instances on a diagram!

If you find any more non-compliances in EA could you let us know please, at [email protected], thanks.

Neil
The Sparx Team
[email protected]

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8030
  • Karma: +118/-20
    • View Profile
Re: Multiple instances of a class in a diagram
« Reply #7 on: November 09, 2004, 05:35:51 pm »
Another thing.

If you create the two diagrams as Thomas suggested, drag them from the tree view onto a third diagram (or one of them onto another) as a diagram frame then you get a diagram that shows both relationships at once.

It is clear that it's a different diagram, but if you're desperate to show two instances at once without using Sargasso's solution then it's worth a try.

Simon

Javier

  • EA User
  • **
  • Posts: 67
  • Karma: +0/-0
  • Necessity is the mother of email
    • View Profile
Re: Multiple instances of a class in a diagram
« Reply #8 on: November 10, 2004, 09:06:02 am »
KP,

In my opinion, it just makes sense to have multiple instances of the same class in a diagram.  The reason is to avoid clutterness.  Consider the Kernel::Root diagram in the UML2 specification--it seems you have it ;)

Often times--at least in my designs--, a class has multiple associations and drawing a comprehensible diagram becomes an exercise in frustration once the association lines start crossing.

Without comparing to EA, I find the feature very useful in Rose and I believe several users would benefit from such an enhancement.

Regards,

Javier
We must become the change we want to see.
- Ghandi

CJ

  • EA User
  • **
  • Posts: 288
  • Karma: +0/-0
    • View Profile
Re: Multiple instances of a class in a diagram
« Reply #9 on: November 10, 2004, 10:25:13 am »
G'day folks,

If this (ability to place and multiple copies of an element on a diagram) does get added as a feature, please make it an optional feature (always allow, or never allow)!

I use the same technique as Thomas on the odd occasion that it's needed.
« Last Edit: November 10, 2004, 10:25:43 am by jasonv »
Cheers and best regards.