Book a Demo

Author Topic: Logical/Class Model: Relations  (Read 14000 times)

KtX2SkD

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Logical/Class Model: Relations
« on: October 24, 2012, 05:57:16 am »
Hello. I would like to ask about the "Association" relation used within a Class Diagram. My previous understanding is that": it should be used when two sides are aware of each other, so I was mostly using it when:
1) Each side was using something from the other.
2) Each instance of a side could have a collection of instances of the other side for reference, due to some conceptual relation.

However, I've been recently told that a class diagram should, eventually, end up with zero association relations, as the association relation is a weak, non-descriptive relation.

I could change cases #1 & #2 into bidirectional dependency and bidirectional composition/aggregation respectively in most situations, but I have a feeling that it will not suffice in some other cases.

Based on this new understanding I'm getting, what's the point of the existence of "association" links? Are they just for temporary usage? or do they have a real permanent role in some situations? and if so, then could I know about some examples?

Forward thanks. Regards, Gari.

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Logical/Class Model: Relations
« Reply #1 on: October 24, 2012, 09:45:00 am »
Quote
However, I've been recently told that a class diagram should, eventually, end up with zero association relations, as the association relation is a weak, non-descriptive relation.
It is possible that they were making the point that you can add extra information to an association by adding a composition or aggregation diamond to one end. I wouldn't personally consider an association without one to be incomplete though. Or weak and non-descriptive.
The Sparx Team
[email protected]

MMA

  • EA User
  • **
  • Posts: 63
  • Karma: +3/-0
    • View Profile
Re: Logical/Class Model: Relations
« Reply #2 on: October 24, 2012, 10:33:59 am »
Firstly, let me clarify some concepts according to my understanding:
1. Association End == Property, can be owned by Classifier or Association itself (e.g. N-ary Association)
2. In most cases, we are talking about Binary Association and the Association End is owned by the classifier connected to the Association.
   In this case, Association End == Property == Classifier's attribute
3. Composition = Binary Association + (Property::aggregation = composite)
4. Aggregation = Binary Association + (Property::aggregation = shared)

Martin Fowler, The author of "UML Distilled" suggests that the aggregation link should not be used at all because it has no added value and it disturb consistency, Quoting  Jim Rumbaugh "Think of it as a modeling placebo".
http://martinfowler.com/bliki/AggregationAndComposition.html

There is another clue for difference between Aggregation and Association, please refer to:      http://ootips.org/uml-hasa.html
         Aggregation is exactly the same as an association with the exception that instances cannot have cyclic aggregation relationships.

5. Dependency and Association describe things from different angle.
   When talking about Dependency, there must be Supplier & Client. In UML, there are heaps of stereotyped dependency (e.g. <<use>>, <<trace>> ...)
   When talking about association, one classifier has an attribute(Property) typed by another classifier; the instance of one classifier has (either owned or as reference) an instance of another classifier playing the role of the attribute.
   Association usually implies dependency, but again, they dscribe things from different angle.
  
For example, in a basketball team, we may have following model:
Team
  center: Player
  small_forward: Player
  power_forward: player
  point_guard: Player
  shooting_guard: Player
  logo: Image  (composite)

(1) there is dependency implied: if Player(Supplier) changed (e.g. all instances of Player can shoot from 100 yards away), then the Team(Client) must change(different offensive and defend tactics)
(2) 5 Team->Player associations or aggregations are implied; Each association has an association end owned by Team.
    If instance of Team disband, instances of Player in this team can play for the other teams.
      However, the team logo will be destroyed as well.
(3) If we create an instance "MiamiHeat :Team", then we can recruit James play the role of power_forward, Wade play the role of shooting_guard...
-------------------------
According to your question, the #1&#2 depends on the navigability of your association. They are not true if the association is not bi-directional.
When do diagramming, the confusion usually comes from Aggregation VS Association. (answered by Martin Fowler ;))
people usually don't have problem of using Composition if they have a clear design.
    E.g. One modeler may design Car-Wheel to be composite while another one may think it is aggregation.
    We can always find exception in real world against an existing model, which was designed to solve a problem in a specific context.
      E.g. If I design wheels to be welded together with the car, it is composite; vice versa.

Personally, I think "end up with zero association relations" can not be applied to all cases (actually I think it is wrong if I don't know the context).
Just as the example above, one might prefer to create 5 attributes typed by Player while another modeler might prefer to use association to represent them.

In summary, Association is widely used in modeling. One concrete example is the UML Specification, refer to "Abstract Syntax" in each chapter.
« Last Edit: October 24, 2012, 10:54:27 am by milesma »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Logical/Class Model: Relations
« Reply #3 on: October 25, 2012, 12:27:57 am »
Quote
There is another clue for difference between Aggregation and Association, please refer to:      http://ootips.org/uml-hasa.html
         Aggregation is exactly the same as an association with the exception that instances cannot have cyclic aggregation relationships.
I think even this statement is an interpretation of the UML specifications and not a "real" UML rule.
Only for compositions the UML specifications mention
Quote
Compositions may be linked in a directed acyclic graph with transitive deletion characteristics;
, but not for aggregations.

The only "hard" difference I found between a normal association and an aggregation is the fact that aggregations are always binary associations.
All the rest is left up to the interpretation of the writer/reader of the model.

If've written a blog post about this subject that might interest you:
UML Composition vs Aggregation vs Association

Geert

KtX2SkD

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Logical/Class Model: Relations
« Reply #4 on: October 25, 2012, 01:31:25 am »
mmm....

Unfortunately, I'm having bit of a difficulty to understand half what is being said, and same goes for the references mentioned, but I'm getting the general concept that you guys seem to agree on the usability of associations, and aggregations being debatable.

Well, unless I have a clear understanding myself, I will not be able to debate the issue with my instructor, so I'll have to reread the stuff a few times until I understand the concepts.

For now, you guys keep mentioning "UML specifications" a few times. Are you talking about the original standard? If so, is it this one [here]?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Logical/Class Model: Relations
« Reply #5 on: October 25, 2012, 02:28:08 am »
Quote
For now, you guys keep mentioning "UML specifications" a few times. Are you talking about the original standard? If so, is it this one [here]?

Yes

Geert