Solved

Association Classes in java

Posted on 2013-12-10
5
506 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
pairs challenge 5 44
Java and GPO 11 47
Error with Java/Cache JDBC Classpath 2 19
github account with ecipse 1 16
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

708 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

16 Experts available now in Live!

Get 1:1 Help Now