Solved

Association Classes in java

Posted on 2013-12-10
5
511 Views
Last Modified: 2014-01-15
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
0
Comment
Question by:gudii9
  • 3
  • 2
5 Comments
 
LVL 11

Expert Comment

by:Angelp1ay
ID: 39710204
Association classes in the UML world are essentially classes that define some logic about a relationship.

Example taken from http://www.agilemodeling.com/style/classDiagram.htm
An association class describing the relation between student and course
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.
0
 
LVL 11

Expert Comment

by:Angelp1ay
ID: 39710218
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.
0
 
LVL 7

Author Comment

by:gudii9
ID: 39727236
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
0
 
LVL 11

Accepted Solution

by:
Angelp1ay earned 500 total points
ID: 39732680
Very generally UML is for describing the logic of a system for the purpose of communicating that logic to other people and Java is for describing a specific code implementation of that logic in a manner a computer can interpret.

UML is often used to describe semantics - the true meaning of something, whereas a real world implementation makes certain assumptions to simplify the code. Java is a simpler language to use without adding the complication of association classes. Functionally the same can be achieved in Java without them. To a person however the UML description including association classes is richer.

It's a little like how in human language we have many words describing very similar concepts because one word may have a subtle implication that helps people more rapidly understand the exact context being described. In programming however we have a very small vocabulary to avoid any ambiguity when communicating with the computer running the code.
0
 
LVL 7

Author Comment

by:gudii9
ID: 39738542
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
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Starting to learn JAVA, 7 59
create a gui in perl 3 71
eclipse compiler vs Installed JREs option 3 76
Configure a Bean in an XML file 4 6
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now