Understanding associative classes

43 views
Skip to first unread message

enrico belletti

unread,
Aug 17, 2010, 12:48:35 AM8/17/10
to UML Forum
Hello all.

I'm having some issue while applying the concept of associative class
on an exercise i have to complete.
So far i have always thought that an associative class is "only"
useful if the cardinality "multiplicity" between to classes is greater
then 1.
so for example:
"in a transports company there are several trucks that can only refill
with fuel at the garage's tank station where there are different
pumps, each time that the trucks refill fuel, a file is issued, the
file contains information's about the amount liters used, this file is
the associative class so.....i will write the classes in capital

(zero or more)TRUCK------------------>(refills at one or more)PUMP

the associative classe is in between lets call it REFILLRAPPORT"

now what if the pump is only one in the tank station:

(zero or more)TRUCK------------------>(refills at ONLY ONE)PUMP

I think that in this case an associative class (REFILLRAPPORT)
containing the information's about the liters used its still useful,
but since the PUMP is only one, according to the associative class
concept this makes no sense.
how can i save in this case the "REFILLRAPPORT" information's?
As attribute of the TRUCK or of the PUMP?

Thank you

H. S. Lahman

unread,
Aug 17, 2010, 10:47:55 AM8/17/10
to umlf...@googlegroups.com
Responding to belletti...

> So far i have always thought that an associative class is "only"
> useful if the cardinality "multiplicity" between to classes is greater
> then 1.
>

The association class is *required* for *:* associations because such
associations cannot be resolved with a simple referential attribute on
one side or the other. Essentially the association class is a
placeholder for a more complex underlying implementation. Thus quite
commonly the association will be reified at OOP time into something like

<pre>
[Assoc]
|
* | R1 *
[Client] ---------------------- [Service]

goes to

* R1A 1 1 R1B *
[Client] ------------- [Assoc] ---------------- [Service]

or some other combination of 1:* multiplicities.
</pre>

However, association classes are also useful when the relationship
itself is qualified in the problem space. For example,

<pre>
[Contract]
+ expiration
|
1 | R1 1
[Buyer] ----------------------- [Vendor]
</pre>

In this case the notion of 'contract' applies to How the entities are
related, not Who participates. Now the association object is a true
problem space abstraction with its own intrinsic responsibilities.

--
Life is the only flaw in an otherwise perfect nonexistence
-- Schopenhauer

H. S. Lahman
H.la...@verizon.net
software blog: http://pathfinderpeople.blogs.com/hslahman/index.html

Reply all
Reply to author
Forward
0 new messages