Book a Demo

Author Topic: UML connections?  (Read 4515 times)

Stringer

  • EA User
  • **
  • Posts: 37
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
UML connections?
« on: September 09, 2007, 09:39:37 pm »
Hello,

which connection type should I use for a class-diagram where my class makes instances of other classes and add them to the first class's Controls-collection? I mean my class X creates random intances of classes Y,Z or N. Then it adds them to the Controls-collection of the class X.


Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: UML connections?
« Reply #1 on: September 09, 2007, 09:53:50 pm »
Hmm, that depends on the type of relationship between your classes.
If you search for "composite" on the forum you should find some discussions on composite vs aggregation. That should get you started.
« Last Edit: September 09, 2007, 09:54:01 pm by Geert.Bellekens »

sargasso

  • EA Practitioner
  • ***
  • Posts: 1406
  • Karma: +1/-2
  • 10 COMFROM 30; 20 HALT; 30 ONSUB(50,90,10)
    • View Profile
Re: UML connections?
« Reply #2 on: September 09, 2007, 11:21:23 pm »
There is, IMO, no (direct) relationship between the "Controls" attribute of the owning class and the items in the collection.  There is an association (whatever aggrgation you desire) between the classifier of the created things and the classifier you use to model the collection.  At the collection end it associates to the "item" or "items" attribute.  There is also an association between the instantiating class and the "collection" classifier.

hth
bruce
"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.

Stringer

  • EA User
  • **
  • Posts: 37
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: UML connections?
« Reply #3 on: September 10, 2007, 03:06:24 am »
So what is the proper connection type when I do quick connection? "Usage" dependency?

This is simplified source:

class Y : UserControl
{
}
class Z : UserControl
{
}
class N : UserControl
{
}
class X : Form
{
  public X()
  {
     this.Controls.Add(new Y());
     this.Controls.Add(new Z());
     this.Controls.Add(new N());
  }
}

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: UML connections?
« Reply #4 on: September 10, 2007, 03:15:56 am »
I guess that would be a classic case of a composition.

Stringer

  • EA User
  • **
  • Posts: 37
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: UML connections?
« Reply #5 on: September 10, 2007, 04:02:55 am »
Ah thanks! Composite it is then.

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: UML connections?
« Reply #6 on: September 10, 2007, 04:47:41 am »
Quote
Ah thanks! Composite it is then.

Stringer,

That should be composition, rather than composite. Make sure you are not using the EA concept of "composite element" instead of the UML concept of "composition."

David
No, you can't have it!

Stringer

  • EA User
  • **
  • Posts: 37
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: UML connections?
« Reply #7 on: September 10, 2007, 05:08:48 am »
Midnight, sorry, it indeed was composition in the quick connect menu.

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: UML connections?
« Reply #8 on: September 10, 2007, 06:29:47 am »
Quote
Midnight, sorry, it indeed was composition in the quick connect menu.

All's well then. I just wanted to make sure you did not trip over the terminology.

David
No, you can't have it!