Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Some questions about Association class.

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have some questions about Association Class.
I understand that there can be only an instance of the association class for any given pair of objects

- Can be Association Class added for one-to-one association? Is it common?

For example, there is association Flight-Airplane 1:1, and association class Assign. Class Assign has two attributes: data, time.

- Is it possible by instance of association class Assign find corresponding pair of object Flight and Airplane?

- Although the multiplicity of association is 1:1, is it correct that in different time Airplane can be assigned to different flights, or multiplicity must be *:1 in this case?


Thanks a lot.
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Andrew Tibets:
I understand that there can be only an instance of the association class for any given pair of objects



Make that "for any given link between two objects". A given pair of objects might well be linked more than once.


- Can be Association Class added for one-to-one association? Is it common?



Yes, of course it can - why not?

Is it common? I don't know...

For example, there is association Flight-Airplane 1:1, and association class Assign. Class Assign has two attributes: data, time.

- Is it possible by instance of association class Assign find corresponding pair of object Flight and Airplane?



I think that depends on how the association class is implemented. If it were possible, I probably would decide to not depict it as an association class, though.


- Although the multiplicity of association is 1:1, is it correct that in different time Airplane can be assigned to different flights, or multiplicity must be *:1 in this case?



The latter. The normal rules for associations still apply, it's just that the association itself has some attributes.
 
Andrew Tibets
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ilja,

Thank you for clarification.

Regard
Andrew
 
author
Posts: 608
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
At association class example I describe three style guidelines you may be interested in:
1. Model Association Classes On Analysis Diagrams. The figure shows that association classes are depicted as class attached via a dashed line to an association � the association line, the class, and the dashed line are considered one symbol in the UML. The reason why I only show them on analysis class diagrams is because you can't directly implement them in any OO language that I know of, that instead you need to resolve them. The implication is that the concept really isn't so useful.

2. Do Not Name Associations That Have Association Classes. The class has a name, so name it intelligently.

3. Center The Dashed Line of an Association Class. It makes it clearer.

These style guidelines are extracted from The Elements of UML 2.0 Style.

- Scott
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic