Solved

Association Classes in java

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB Script to add site to Java Exception List 4 76
Should localization be done inside spring controller 5 25
Configure a Bean in an XML file 4 31
hibernate jars 4 28
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
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.

776 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