gudii9
asked on
Association Classes in java
What are the association classes. What, how, why, when, where we use them. What are advantages, disadvantages, practical uses of them. How we represent them in UML
please advise
Any links resources ideas highly appreciated. Thanks in advance
please advise
Any links resources ideas highly appreciated. Thanks in advance
Association classes cannot really exist in Java - you are forced to define all 3 classes and 2 relations with the enrollment type in the middle.
In some senses this is why UML exists - it explains the true semantics even if the implementation makes some sacrifices.
In some senses this is why UML exists - it explains the true semantics even if the implementation makes some sacrifices.
ASKER
Association classes cannot really exist in Java - you are forced to define all 3 classes and 2 relations with the enrollment type in the middle.
In some senses this is why UML exist
You could model them in-line splitting the relation to instead form 2 relations
relation with meta data is a better description of the logic than 3 classes and 2 relations
I am still not very clear on above points.
Why java does not have but UML has them. what compromise we are making. Please advise
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
You could model them in-line splitting the relation to instead form 2 relations (source > association class and association class to target, in this case student > enrollment and enrollment > course). Typically they exist because the concept of a relation with meta data is a better description of the logic than 3 classes and 2 relations i.e. the student is enrolled in a class and that enrollment occurred at a certain time, rather than students have enrollments, enrollments have classes which is perhaps less obvious.
can you please elaborate on above. I am not able to clearly understand it. Are you referring in UML context or java context?
In java where does (which class student/course out of two classes) the enrollment drop create etc represented
Example taken from http://www.agilemodeling.com/style/classDiagram.htm
You could model them in-line splitting the relation to instead form 2 relations (source > association class and association class to target, in this case student > enrollment and enrollment > course). Typically they exist because the concept of a relation with meta data is a better description of the logic than 3 classes and 2 relations i.e. the student is enrolled in a class and that enrollment occurred at a certain time, rather than students have enrollments, enrollments have classes which is perhaps less obvious. UML after all is a language for describing logic and sharing that description with others.