Solved

Association Classes in java

Posted on 2013-12-10
5
541 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses

623 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